Post by bobowk on Apr 8, 2016 10:51:56 GMT 10
I would to add tabs above the toolstrip. Example, like in MoonDrop browser, you have the tabs above the the controls where the combobox and back, forward, etc. buttons are. I dont have any code but I have attempted 2 tab controls controlling each other but that didn't work. I also tried to put the toolstrip in the tabcontrol but that didn't work. I DON'T WANT IT IN THE TITLEBAR! Just below the titlebar. Kind Regards, Brandon
|
|
Post by Nathan Lecompte on Apr 8, 2016 17:51:12 GMT 10
Hey bobowk, This has been asked on the forum MANY times, here's the answer I give most people in summary: For the Tab, ensure that you create a User Control (a special kind of form which can be inserted into another form an acts like a component or control of the Toolbox); just code the stuff you'd want to see in the tab in the User Control (for example, put your Toolstrip and WebBrowser there and apply code for those specific components). On your Main Form add your TabControl and then create a sub/function in the Main Forms code to apply a tab (basically; add a tab and then apply the User Control as you would regularly add the WebBrowser control). The sub/function can then be accessed from the User Control. Other functions can also be added to the Main Form and can then be called by the User Control/s (this could be done for something like "Opening a Link in a New Tab" and other functions which might require storage, since the tabs are discarded and can only temporarily store information).Hope this helps! Ps: I'm probably gonna make another "How To Make a WebBrowser" video with more updated information such as this and using other Web-Control engines (since a lot of the questions on the forum usually relate to those topics)
|
|
Post by bobowk on Apr 8, 2016 18:46:19 GMT 10
I come up with an error... In the tab command. Here is my code: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TabControl1.TabPages.Add(1, "NewTab" & i)
TabControl1.SelectTab(1 - 1) TabControl1.SelectedTab.Controls.Add(UserControl1)
i = i + 1
End Sub
|
|
Post by bobowk on Apr 8, 2016 18:48:57 GMT 10
Error: Error 1 'UserControl1' is a type and cannot be used as an expression. C:\Users\WOO0029\Documents\Visual Studio 2012\Projects\WindowsApplication48\WindowsApplication48\Form1.vb 9 46 WindowsApplication48
|
|
Post by Nathan Lecompte on Apr 8, 2016 22:52:08 GMT 10
You'll have to create a new User Control for each tab, like so:
Public Sub AddNewTab()
Dim BrowserTab As New UserControl1 TabControl1.TabPages.Add(1, "NewTab" & i) TabControl1.SelectTab(1 - 1) TabControl1.SelectedTab.Controls.Add(BrowserTab) i = i + 1
End Sub
|
|