Grunge
asked on
For Each control in TabPage
hi all!
Dim n As CheckBox
For Each n In fMain.tabReports.Controls
n.Checked = False
Next
Dim n As CheckBox
For Each n In fMain.tabReports.ControlCo llection
n.Checked = False
Next
neither of these work... ideas?
Dim n As CheckBox
For Each n In fMain.tabReports.Controls
n.Checked = False
Next
Dim n As CheckBox
For Each n In fMain.tabReports.ControlCo
n.Checked = False
Next
neither of these work... ideas?
ASKER
that returns an "invalid cast"
.............i should mention that tabReports is a tabPage (one of serveral) on a tab control (tabAll)
.............i should mention that tabReports is a tabPage (one of serveral) on a tab control (tabAll)
ASKER
so i tried
For Each n In fMain.tabAll.TabPages(1).C ontrols()
n.Checked = False
Next
no joy
For Each n In fMain.tabAll.TabPages(1).C
n.Checked = False
Next
no joy
Dim chk As New CheckBox
Dim ctl As Control
For Each ctl In TabPage1.Controls
If ctl.GetType.ToString = chk.GetType.ToString Then
CType(ctl, CheckBox).Checked = True
End If
Next
Dim ctl As Control
For Each ctl In TabPage1.Controls
If ctl.GetType.ToString = chk.GetType.ToString Then
CType(ctl, CheckBox).Checked = True
End If
Next
That doesn't work because the Controls collection most likely has more than just checkboxes. You need to test for that...
For Each ctl As Control In fMain.tabReports.TabPages( 1).Control s()
Try
Dim chk As CheckBox = CType(ctl, CheckBox)
chk.Checked = False ' If you make it this far, the control is a Checkbox
Catch
'Ignore invalid cast exception
End try
Next
For Each ctl As Control In fMain.tabReports.TabPages(
Try
Dim chk As CheckBox = CType(ctl, CheckBox)
chk.Checked = False ' If you make it this far, the control is a Checkbox
Catch
'Ignore invalid cast exception
End try
Next
Hi,
I tried something similar, although i omitted the tab page container and just called the tabpage direct.
Dim myChk As CheckBox
For Each myChk In Me.TabPage1.Controls
myCont.Checked = True 'used true for visual confirmation
Next
Any Joy?
BS
I tried something similar, although i omitted the tab page container and just called the tabpage direct.
Dim myChk As CheckBox
For Each myChk In Me.TabPage1.Controls
myCont.Checked = True 'used true for visual confirmation
Next
Any Joy?
BS
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wow this topic suddenly took off!....
give me a tad to check the offerings then i will grade.
Regards
Grunge
give me a tad to check the offerings then i will grade.
Regards
Grunge
ASKER
Thx all for your comments...
For Each c In fMain.tabReports.TabPages(
c.Checked = False
Next