Sheritlw
asked on
Using For Each VB 2008
I am trying to loop through a form that has multiple splitcontainers, comboboxes and grids (FPSpread).
I only want to loop through the grids.
How do I do this?
Dim cnt As FarPoint.Win.Spread.FpSpre ad
For Each cnt In Me.Controls
Thanks
I only want to loop through the grids.
How do I do this?
Dim cnt As FarPoint.Win.Spread.FpSpre
For Each cnt In Me.Controls
Thanks
ASKER
I have probably 30 grids on the form. I need to get the controls name, activesheet, etc.. while looping through so I need to reference the control type as a spread so I don't get errors when trying to loop through them.
The grid has different properties etc. than regular controls.
thanks
The grid has different properties etc. than regular controls.
thanks
Just cast the control found to your class type..
Dim cnt As Control
For Each cnt In Me.Controls
If TypeOf cnt Is FarPoint.Win.Spread.FpSpre ad Then
Dim curGrid As FarPoint.Win.Spread.FpSpre ad = cnt
'' DO SOMETHING
End If
Next Each
Dim cnt As Control
For Each cnt In Me.Controls
If TypeOf cnt Is FarPoint.Win.Spread.FpSpre
Dim curGrid As FarPoint.Win.Spread.FpSpre
'' DO SOMETHING
End If
Next Each
ASKER
Unfortunetly it's not finding the grids. I think it's because my form has a tabcontrol with multiple tabs and a SplitContainer. All the grids are on the splitcontainers.
How do I reference all the splitcontainers and grids?
Thanks
How do I reference all the splitcontainers and grids?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So :
Dim cnt As Control
For Each cnt In Me.Controls
If TypeOf cnt Is FarPoint.Win.Spread.FpSpre
'' DO SOMETHING
End If
Next Each