i am trying to clear all the textboxes contained on all tabpages of a tabcontrol, which is enclosed inside a groupbox. what i have is probably very ugly (plus it doesn't work), so please help.....
(the line in red wouldn't compile)
(the line in red wouldn't compile)
Code:
Dim ctrl As Control
Dim ctrl1 As Control
Dim tBox As TextBox
Dim tBox1 As TextBox
Dim tbPage As TabPage
For Each ctrl In GroupBox2.Controls
If TypeOf ctrl Is TextBox Then
tBox = DirectCast(ctrl, TextBox)
tBox.Clear()
ElseIf ctrl Is TabControl1 Then
Dim i As Integer
For i = 0 To (Me.TabControl1.TabPages.Count - 1)
[COLOR=Red] For Each ctrl1 In Me.TabControl1.TabPages.Item(i)[/COLOR]
If TypeOf ctrl1 Is TextBox Then
tBox1 = DirectCast(ctrl1, TextBox)
tBox.Clear()
End If
Next
Next
End If
Next