Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, July 23, 2013

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

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


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

Solution: -
Store newly added item in listbox’s number in some variable and use that value in place of “NexIndex” as below
Dim currentItemNumber As Integer = mylistbox.Items.Add("MatchName")

mylistbox.SetSelected(currentItemNumber, False)

No comments:

Post a Comment