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.

2
  • 1
    Sorry - I really am finding it very hard to understand the question. Jul 12, 2012 at 9:45
  • i am converting code from VB6 to VB.NET. above coding is come from VB6 and it makes warming in VS2010 . and i want to solve the code which is started with VB6.xxxxx. =] Jul 13, 2012 at 1:56

1 Answer 1

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.

2
  • +1 We could also link to the VB6 documentation on ItemData. 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, 2012 at 16:43
  • Thank you so much, i am trying to move on to others=] Jul 13, 2012 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.