0

I am converting VB6 to VB.NET using VS2010

When I was converting the code, I found something that I don't understand the meaning of what the code is doing and getting and how to convert it well.

i = 0

While Not rd.EOF

        cobTmp.Items.Insert(i, rd.Fields("d").Value)
        VB6.SetItemData(cobTmp, i, rd.Fields("r").Value)
        If rd.Fields("r").Value = "1234" Then
            intloc1234 = i
        End If
        rd.MoveNext()
        Debug.Print(VB6.TabLayout(VB6.GetItemData(cobTmp, i), VB6.GetItemString(cobTmp, i)))
        i = i + 1
    End While

How can I handle this code well and for this line:

Debug.Print(VB6.TabLayout(VB6.GetItemData(cobTmp, i), VB6.GetItemString(cobTmp, i)))

Can I use cobTmp.item(i) to replace VB6.GetItemData(cobTmp, i)?

How about VB6.TabLayout??

I know these can be ignored, but I want to do it better.

Deanna
  • 23,876
  • 7
  • 71
  • 156
user1506228
  • 45
  • 4
  • 10

1 Answers1

1

Regarding GetItemData, according to Microsoft Support:

In Visual Basic 6.0, the ItemData property for a ListBox or ComboBox control could be set at design time in the Properties window to associate an Integer with a ListBox or ComboBox item. In Visual Basic 2010, the ItemData property no longer exists; the GetItemData and SetItemData methods can be used to emulate the behavior of ItemData.

Regarding TabLayout, according to this Microsoft Support Article:

In Visual Basic 6.0, the Debug.Print method had an outputlist parameter that specified how output was formatted in the Immediate window. This function is used by the upgrade tools to translate the outputlist parameter into a string for display in the Immediate window.

C-Pound Guru
  • 15,967
  • 6
  • 46
  • 67
  • +1 We could also link to the VB6 documentation on [`ItemData`](http://msdn.microsoft.com/en-us/library/aa235132(v=vs.60).aspx). But if the `ItemData` and `TabLayout` is really only used in a `Debug.Print` statement, just delete the code and move on to something else :) Debug.Print is just a logging statement. – MarkJ Jul 12 '12 at 16:43
  • Thank you so much, i am trying to move on to others=] – user1506228 Jul 13 '12 at 01:54