Post by zealot on Apr 22, 2016 8:42:56 GMT 10
How do I add a UserControl to SuperTabControl and why is the add tab button not appearing?
|
|
Post by Nathan Lecompte on Apr 22, 2016 13:29:55 GMT 10
|
|
Post by zealot on Apr 24, 2016 4:13:39 GMT 10
I do not see the add tab button and I keep getting a error for usercontrol
|
|
Post by Nathan Lecompte on Apr 24, 2016 9:18:06 GMT 10
I do not see the add tab button and I keep getting a error for usercontrol You'll need to be more descriptive, what's the error? What is shown? Maybe a screenshot or a snippet of code you're using?
|
|
Post by bobowk on Apr 24, 2016 11:14:47 GMT 10
1. Create a usercontrol and add all your webbrowsers (Assuming you are making a webbrowser) and buttons there. After, go to your tab.vb file or wherever your tabs are and use this code to your form_load code:
Try Dim controluser As New UserControl1 '< Declare your usercontrol Dim newTab As SuperTabItem = SuperTabControl1.CreateTab("New Tab", SuperTabControl1.Tabs.Count - 1) ' < Create new tab Dim panel As SuperTabControlPanel = DirectCast(newTab.AttachedControl, SuperTabControlPanel) 'Add attached panel newTab.Size = New Size(150, 25) ' Fixed size controluser.Dock = DockStyle.Fill ' Dock Usercontrol panel.Controls.Add(controluser) ' Add controluser SuperTabControl1.SelectedTabIndex = SuperTabControl1.Tabs.Count - 2 SuperTabControl1.BackColor = Color.Transparent Catch ex As Exception End Try End If If this helped, please press SOLVED.
|
|
Post by Nathan Lecompte on Apr 24, 2016 12:24:29 GMT 10
I meant as in, what part of the code is triggering an error, and what that error says. However I'm just gonna guess that that's the code you're using, which already shows a couple of errors. I'll clean up the code and explain what's going on: 1. There's no need to create a SuperTabControlPanel, so that can be removed 2. The tabs can't individually be set fixed sizes, there's a property in the SuperTabControls' property list called FixedTabSize; you'll need to change that to whatever fixed tab size (I think from what I can remember it only allows for a fixed width, but I might be wrong) to whatever size you'd want all tabs to maintain. 3. You haven't actually added the tab to the SuperTabControl, you merely declared it and only added the User Control to the SuperTabControl panel (which also wasn't applied to the TabItem). 4. There's also a useless "End If" deceleration at the end of your code, but I'm hoping that's just because you copied the snippet from your main source code Here you go:Dim Browser As New UserControl1 '< Declare your User Control SuperTabControl1.CreateTab("New Tab #7831g581n4m") '< Create the tab with a temporary dummy title Browser.Name = "Browser" '< Name the User Control Browser.Dock = DockStyle.Fill '< Set the User Controls Dock to fill the whole tab Browser.WebControl.Source = New Uri("http://www.techviewforum.com") '< Set the WebControl in the User Control to navigate to the TechViewForum (can be changed) Do Until SuperTabControl1.SelectedTab.Text = "New Tab #7831g581n4m" '< Select the Tab with the dummy title SuperTabControl1.SelectNextTab() Loop SuperTabControl1.SelectedTab.AttachedControl.Controls.Add(Browser) '< Add the User Control to the Tab SuperTabControl1.FixedTabSize = New Size(150, 25) '< Set the size of all tabs to this width (can also be changed from the SuperTabControls properties in Design View)
Hope this helps!
|
|
Post by zealot on Apr 25, 2016 2:11:22 GMT 10
I meant as in, what part of the code is triggering an error, and what that error says. However I'm just gonna guess that that's the code you're using, which already shows a couple of errors. I'll clean up the code and explain what's going on: 1. There's no need to create a SuperTabControlPanel, so that can be removed 2. The tabs can't individually be set fixed sizes, there's a property in the SuperTabControls' property list called FixedTabSize; you'll need to change that to whatever fixed tab size (I think from what I can remember it only allows for a fixed width, but I might be wrong) to whatever size you'd want all tabs to maintain. 3. You haven't actually added the tab to the SuperTabControl, you merely declared it and only added the User Control to the SuperTabControl panel (which also wasn't applied to the TabItem). 4. There's also a useless "End If" deceleration at the end of your code, but I'm hoping that's just because you copied the snippet from your main source code Here you go:Dim Browser As New UserControl1 '< Declare your User Control SuperTabControl1.CreateTab("New Tab #7831g581n4m") '< Create the tab with a temporary dummy title Browser.Name = "Browser" '< Name the User Control Browser.Dock = DockStyle.Fill '< Set the User Controls Dock to fill the whole tab Browser.WebControl.Source = New Uri("http://www.techviewforum.com") '< Set the WebControl in the User Control to navigate to the TechViewForum (can be changed) Do Until SuperTabControl1.SelectedTab.Text = "New Tab #7831g581n4m" '< Select the Tab with the dummy title SuperTabControl1.SelectNextTab() Loop SuperTabControl1.SelectedTab.AttachedControl.Controls.Add(Browser) '< Add the User Control to the Tab SuperTabControl1.FixedTabSize = New Size(150, 25) '< Set the size of all tabs to this width (can also be changed from the SuperTabControls properties in Design View)
Hope this helps! Thanks but the add tab button I will show a image.
|
|
Post by Nathan Lecompte on Apr 25, 2016 10:26:32 GMT 10
Well there's no code in the add tab sub, so maybe you should do that first. Also, maybe on Form_Load add a tab, since you're launching the program without any tabs at the moment (from the looks of it). If it still doesn't work then just feel free to send in the project (via Messages if you don't want anyone else to see it) and I'll just fix it for you
|
|
Post by zealot on Apr 27, 2016 8:18:18 GMT 10
Well there's no code in the add tab sub, so maybe you should do that first. Also, maybe on Form_Load add a tab, since you're launching the program without any tabs at the moment (from the looks of it). If it still doesn't work then just feel free to send in the project (via Messages if you don't want anyone else to see it) and I'll just fix it for you I want the add tab button like Lumia Browser 1
|
|
Post by Nathan Lecompte on Apr 27, 2016 15:19:12 GMT 10
Well there's no code in the add tab sub, so maybe you should do that first. Also, maybe on Form_Load add a tab, since you're launching the program without any tabs at the moment (from the looks of it). If it still doesn't work then just feel free to send in the project (via Messages if you don't want anyone else to see it) and I'll just fix it for you I want the add tab button like Lumia Browser 1 That was basically just placing a button on a form, bringing it to the very front and then anchoring it to the Top-Right... I think that if your button is disappearing then it's probably because it's contained in the SuperTabControl (as in, you dragged yo button onto the SuperTabControl...which doesn't support the containment of external objects such as buttons unless you do it via the control, like right-clicking the control and selecting "Add XButton" or something of the sort).
|
|