'My Base form (which I inherit in new update forms) has a toolbar which has buttons for Add, Edit, Delete etc. This form always has a tabcontrol and at least 1 tabpage. I have code (see below) that iterates through the controls on this forms Tabcontrols Tabpage (first one) and sets the control properties (for textbox and combobox) as required (this works fine). My problem is that I may have a Tabcontrol within this forms Tabcontrols 1st Tabpage, which itself has a number of Tabpages. I want to identify these Tabcontrols and iterate though their Tabpages looking for textbox and combobox controls so I can set their .text and .enable properties as required.
'Code assumes you have a form with a tabcontrol named 'TabCtrl1' and optional to see results need a text and/or combo box on the TabControls 1st TabPage.
Dim i As Integer
For i = 0 To Me.TabCtrl1.TabPages(0).Controls.Count - 1
If Me.TabControl1.TabPages(0).Controls(i).GetType() Is GetType(System.Windows.Forms.TextBox) Then
Me.TabCtrl1.TabPages(0).Controls(i).Text = ""
Me.TabCtrl1.TabPages(0).Controls(i).Enabled = True
Me.TabCtrl1.TabPages(0).Controls(i).ForeColor = color.blue
Me.TabCtrl1.TabPages(0).Controls(i).BackColor = color.yellow
ElseIf Me.TabCntrl1.TabPages(0).Controls(i).GetType() Is GetType(System.Windows.Forms.ComboBox) Then
Me.TabCtrl1.TabPages(0).Controls(i).Text = "NA"
Me.TabCtrl1.TabPages(0).Controls(i).Enabled = True
Me.TabCtrl1.TabPages(0).Controls(i).ForeColor = color.blue
Me.TabCtrl1.TabPages(0).Controls(i).BackColor = color.yellow
ElseIf Me.TabCtrl1.TabPages(0).Controls(i).GetType() Is GetType(System.Windows.Forms.TabControl) Then
' ...want code here to iterate through all the tab pages on this tabcontrol and set the textbox controls and combobox controls .text property and .enables property.
End If
Any Help appreciated.
Cheers
Kieran
'Code assumes you have a form with a tabcontrol named 'TabCtrl1' and optional to see results need a text and/or combo box on the TabControls 1st TabPage.
Dim i As Integer
For i = 0 To Me.TabCtrl1.TabPages(0).Controls.Count - 1
If Me.TabControl1.TabPages(0).Controls(i).GetType() Is GetType(System.Windows.Forms.TextBox) Then
Me.TabCtrl1.TabPages(0).Controls(i).Text = ""
Me.TabCtrl1.TabPages(0).Controls(i).Enabled = True
Me.TabCtrl1.TabPages(0).Controls(i).ForeColor = color.blue
Me.TabCtrl1.TabPages(0).Controls(i).BackColor = color.yellow
ElseIf Me.TabCntrl1.TabPages(0).Controls(i).GetType() Is GetType(System.Windows.Forms.ComboBox) Then
Me.TabCtrl1.TabPages(0).Controls(i).Text = "NA"
Me.TabCtrl1.TabPages(0).Controls(i).Enabled = True
Me.TabCtrl1.TabPages(0).Controls(i).ForeColor = color.blue
Me.TabCtrl1.TabPages(0).Controls(i).BackColor = color.yellow
ElseIf Me.TabCtrl1.TabPages(0).Controls(i).GetType() Is GetType(System.Windows.Forms.TabControl) Then
' ...want code here to iterate through all the tab pages on this tabcontrol and set the textbox controls and combobox controls .text property and .enables property.
End If
Any Help appreciated.
Cheers
Kieran