G
Guest
Hi,
I have an tab control in one of the forms and it has two tab strips. Now I
have written an general function that accepts form name as parameter and
iterates through all the controls in the form and re-initialises that.
Now in this context, i have around 15 controls on one of the tab strips page
1 and 5 controls in tab strip 2.
now when i iterate through the controls, i am getting the control collection
as 3 as there are two more button on the page.
Can anyone please help me how do i access all the controls on the tabstrip.
Here is the code that i am using for the same.
Public Sub ClearFormElements(ByVal sForm As Form)
Dim vControl As System.Windows.Forms.Control
For Each vControl In sForm.Controls
If TypeOf vControl Is System.Windows.Forms.TextBox Then
vControl.Text = ""
End If
If TypeOf vControl Is System.Windows.Forms.ComboBox Then
vControl.Text = ""
End If
If TypeOf vControl Is System.Windows.Forms.DateTimePicker Then
vControl.Text = Convert.ToDateTime(Now()).ToString
End If
If TypeOf vControl Is
System.Windows.Forms.TabControl.ControlCollection Then
End If
Next
End Sub
Regards
Sudhakara.T.P.
I have an tab control in one of the forms and it has two tab strips. Now I
have written an general function that accepts form name as parameter and
iterates through all the controls in the form and re-initialises that.
Now in this context, i have around 15 controls on one of the tab strips page
1 and 5 controls in tab strip 2.
now when i iterate through the controls, i am getting the control collection
as 3 as there are two more button on the page.
Can anyone please help me how do i access all the controls on the tabstrip.
Here is the code that i am using for the same.
Public Sub ClearFormElements(ByVal sForm As Form)
Dim vControl As System.Windows.Forms.Control
For Each vControl In sForm.Controls
If TypeOf vControl Is System.Windows.Forms.TextBox Then
vControl.Text = ""
End If
If TypeOf vControl Is System.Windows.Forms.ComboBox Then
vControl.Text = ""
End If
If TypeOf vControl Is System.Windows.Forms.DateTimePicker Then
vControl.Text = Convert.ToDateTime(Now()).ToString
End If
If TypeOf vControl Is
System.Windows.Forms.TabControl.ControlCollection Then
End If
Next
End Sub
Regards
Sudhakara.T.P.