This question is locked. New answers and comments are not allowed.
I am new to your controls, in VB.Net I am trying to dynamicaly build a form. I have added the RadTabstrip to my .Net form and I can successfully add tabs in via code. My problem is I want to add controls to the tab via code also(RadTetxbox, RadListbox) however it is not adding the control to the correct tab. Below is the code:
Private Sub Add_Text(ByVal sorder As String, ByVal itab As Integer)
Dim txt As New RadTextBox
txt.Name = "Text_" & sorder
txt.Multiline = True
txt.ScrollBars = ScrollBars.Both
Me.RadTabStrip1.SelectedTab = Me.RadTabStrip1.Items(itab)
Me.TabItem1.ContentPanel.Controls.Add(txt)
itab is the tab I want to add the control to, it always adds the control to my first tab on the RadTabStrip control.
5 Answers, 1 is accepted
0
surfer
Top achievements
Rank 1
answered on 04 May 2007, 06:12 PM
I see that in your code you are adding the RadTextBox to the ContentPanel of the first tab (TabItem1). Maybe you need to change the code
from:
Me.RadTabStrip1.SelectedTab = Me.RadTabStrip1.Items(itab)
Me.TabItem1.ContentPanel.Controls.Add(txt)
to
Me.RadTabStrip1.SelectedTab = Me.RadTabStrip1.Items(itab)
Me.RadTabStrip1.Items(itab).ContentPanel.Controls.Add(txt)
from:
Me.RadTabStrip1.SelectedTab = Me.RadTabStrip1.Items(itab)
Me.TabItem1.ContentPanel.Controls.Add(txt)
to
Me.RadTabStrip1.SelectedTab = Me.RadTabStrip1.Items(itab)
Me.RadTabStrip1.Items(itab).ContentPanel.Controls.Add(txt)
0
bobebs
Top achievements
Rank 1
answered on 04 May 2007, 06:29 PM
Thanks for the reply, this does not work, I get an error
"ContentPanel" is not a member of RadItem"
"ContentPanel" is not a member of RadItem"
0
surfer
Top achievements
Rank 1
answered on 04 May 2007, 06:36 PM
You may need to first cast the object - since the Items collection contains RadItem objects, you need to cast it to TabItem explicitly.
Example:
Dim currentTab As TabItem = DirectCast(Me.radTabStrip1.Items(itab), TabItem)
currentTab.ContentPanel.Controls.Add(txt)
Example:
Dim currentTab As TabItem = DirectCast(Me.radTabStrip1.Items(itab), TabItem)
currentTab.ContentPanel.Controls.Add(txt)
0
bobebs
Top achievements
Rank 1
answered on 04 May 2007, 06:46 PM
Thank you, thank you, thank you --- this works
0
Hi Bob Jackson,
If you need further assistance we will be happy to help you with your issues.
Thanks Matt for your correct responses.
Greetings,
Ray
the telerik team
Instantly find answers to your questions at the new Telerik Support Center
If you need further assistance we will be happy to help you with your issues.
Thanks Matt for your correct responses.
Greetings,
Ray
the telerik team
Instantly find answers to your questions at the new Telerik Support Center