Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, July 23, 2013

'NewIndex' is not a member of 'System.Windows.Forms.CheckedListBox'

During migration from VB to VB.NET if you are getting error as "'NewIndex' is not a member of 'System.Windows.Forms.CheckedListBox'" with following type of code

'UPGRADE_ISSUE: ListBox property myCheckedListBox.NewIndex was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="F649E068-7137-45E5-AC20-4D80A3CC70AC"'
myCheckedListBox.SetSelected(myCheckedListBox.NewIndex, False)

Solution: -
Store number of newly added item of CheckedListBox in some variable and use that value in place of “NexIndex” as below

Dim currentItemNumber As Integer = myCheckedListBox.Items.Add("MatchName")

myCheckedListBox.SetSelected(currentItemNumber, False)

No comments:

Post a Comment