I am trying to get my conversion fixed from a VB6 application over to a VB.net 2010 application. Everything went well but for a few sleeted listbox NewIndex and OLE control.
Below are the trouble lines that could not seem to be converted:
VB6.SetItemData(lstARCurrent, lstARCurrent.NewIndex, (.Fields("approval_s").Value))
OLE1.CreateLink(strFileName)
OLE1.DoVerb(vbOLEOpen)
If anyone has any incite to correct this issue then that would be great as i have not found a way around these errors!
Thanks!
David
That's weird. In VB6 you'd do this:
That was a nice way to store a string into a list box but associate a database ID with it.
I assume your
VB6.SetItemData
routine is doing the same thing. However, in .NET that won't work. For one thing, items in list boxes in VB6 are 1 based instead of 0 based, so that'd probably cause issues, but the .NET list box most likely doesn't have a.NewIndex
property. Neither does a listbox have anItemData
array property.The new way to handle this is to add an entire object and let the
.ToString
method tell the listbox what to display (sorry for C#, my VB.Net is rusty):Then just add the item:
It will display
abc
but you can uselstARCurrent.SelectedItem
to get back theMyItem
object.