Start New Discussion within our Software Development Community

This is probably one of those that is so simple I can't see it. I have a string variable called Market. The variable is user chosen and is the exact same name as one of many tables in my dataset. Basically I am having the user choose which table they want in a combobox, then I want to use that variable to access the table. So if the user picks "Market1" then I want to open the table named Market1.

I am simplifying here, but need to know how to open:

For ds.<variable here>.rows.count - 1
    'perform steps

How do I inject the variable correctly? Thanks ahead of time!

Try This:

    Dim MyTable As String
    MyTable = "Table1"

    For i = 0 To ds.Tables(MyTable).Rows.Count - 1
        'Do Work
This question has already been answered. Start a new discussion instead.