?
Solved

Reference Grid by Appending number to Grid Name

Posted on 2009-04-20
2
Medium Priority
?
302 Views
Last Modified: 2012-05-06
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
Comment
Question by:Sheritlw
2 Comments
 
LVL 48

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 24191445
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
 

Author Closing Comment

by:Sheritlw
ID: 31572596
Thank you
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question