• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Reference Grid by Appending number to Grid Name

I have a form with 6 tabs.  Each tab has 11 grids on it.  On Each tab the grids are named the same... but with the associated tab number at the end.
Example...
fpGrdTires0
fpGrdEngines0
fpGrdLFront0

fpGrdTires1
fpGrdEngines1
fpGrdLFront1

fpGrdTires2
fpGrdEngines2
fpGrdLFront2

There are a lot more grids than these, but should give you the idea.

Now I have 1 Save/Update procedure and I need to reference the grids specifically according to the tab selected.

For example, if tab index 2 is selected, then I need to specify that the grids have the name with the 2 appended to it.  Like me.fpGrdTires & iTabIndex   .... but you can't do that:-(

In VB 6 I used to index the controls, that was real easy.

How would I do this in VB 2008?

Please provide an example.  Clicking on links crashes my IE

Thanks
0
Sheritlw
Asked:
Sheritlw
1 Solution
 
Wayne Taylor (webtubbs)Commented:
It's basically the same as VB6, except you should cast the control to the DataGridView type....

    Dim dgv As DataGridView = CType(Me.Controls("fpGrdTires" & TabControl1.SelectedIndex), DataGridView)

Wayne
0
 
SheritlwAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now