I have this code (below) which works OK and can show me the correct name of the tab controlit found.
I need to loop thru each tab within the control that was found and grab some data. I can't seem to figure out how to find how to do this not using any tab control events. What I am doing is grabbing data from a text box and storing. Works great on all other Infra controls except the tab control. Any thoughtd on how to loop thru each tab?
If TypeOf c Is UltraTabControl Then
'gran each tab data in this control
System.Diagnostics.Debug.WriteLine(c.Name)
End if
Thanks
Hi Greg,
UltraTabControl has Tabs collection and each Tab has TabPage property that gives you access to the Controls collection corresponding for each Tab.
Looking forward to hear from you.
Thanks you for your answer. If i jknow the name of the tab control this works, but I really do not know until run time. Here is the comnplete code listing. It works except for the tab control part. It finds the tab control OK and falls thru, but I can only seem to access the name at that point. Basically this grans all the data from a form and writes to a stringbuilder. Been using for years but recently had to add a tab control and that is the part I can't seem to figure out, Thanks for you quick reply
soxOrig = New StringBuilder
Dim c As Control Dim myForm As Type = Me.GetType() Dim fields As FieldInfo() = myForm.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic)
For Each field As FieldInfo In fields If field.FieldType.Name.ToLower = "ultragroupbox" Then For Each c In Me.grpDetail.Controls If TypeOf c Is UltraTextEditor _ Or TypeOf c Is UltraCurrencyEditor _ Or TypeOf c Is UltraNumericEditor _ Or TypeOf c Is DateTimePicker _ Or TypeOf c Is UltraDateTimeEditor _ Or TypeOf c Is UltraOptionSet _ Or TypeOf c Is UltraTabControl Then If (c.Tag <> "") Then soxOrig.Append(c.Tag & " : " & c.Text.Trim & " | ") End If End If
If TypeOf c Is UltraTabControl Then System.Diagnostics.Debug.WriteLine(c.Name) 'How to access each tabs here? End If Next Exit For End If Next
never mind, I forogt to cast as an ultabcontrol like dim obj as uktrtabcontrol = c first
thanks
Now I understand what you meant by not finding the Tabs collection. Obviously the Control class itself does not know anything about it. I am glad you figured it out!
Please let me know if you have any additional questions.