Insert tab pages dinamically to a tab control
-
Hi guys. I'm begginer to VB.Net. My main form has a main tab control. And when it run 1-imports from Access DB name and numbers of main tab control's Tab and add tabs to existing empty tabcontrol. 2-Also i wanna my program after creation of tabs, imports tab pages from an external files.But I donno how i can perform second step. Please give me a solution with an examle or tutorial.
-
Hi guys. I'm begginer to VB.Net. My main form has a main tab control. And when it run 1-imports from Access DB name and numbers of main tab control's Tab and add tabs to existing empty tabcontrol. 2-Also i wanna my program after creation of tabs, imports tab pages from an external files.But I donno how i can perform second step. Please give me a solution with an examle or tutorial.
Please be specific about what you mean getting tab pages from external files? Do you want to show the content of file inside a tab page when you open a file? :wtf: Dynamically you can add tabs to tab control. Lets get your answer and then see what i can do about it...
What a curious mind needs to discover knowledge is noting else than a pin-hole.
-
Please be specific about what you mean getting tab pages from external files? Do you want to show the content of file inside a tab page when you open a file? :wtf: Dynamically you can add tabs to tab control. Lets get your answer and then see what i can do about it...
What a curious mind needs to discover knowledge is noting else than a pin-hole.
Oh.Yes. You'r right. I have a program that based on some tabs that those names and number obtain from db. You can think i wanna update my program and wanna just change some dll or everything that you think is possible. How i can change tab pages contents, i mean i wanna set each tab's page's contents from a .dll or something else. means how i can fill each tab's page with my favorite contents such as text boxes,labels and other activeX's.
-
Oh.Yes. You'r right. I have a program that based on some tabs that those names and number obtain from db. You can think i wanna update my program and wanna just change some dll or everything that you think is possible. How i can change tab pages contents, i mean i wanna set each tab's page's contents from a .dll or something else. means how i can fill each tab's page with my favorite contents such as text boxes,labels and other activeX's.
First, I am sorry to say that your english is not good enough because I am confused by your posted messages. You can't add any textbox, label or etc. to tabpage in runtime but tab page to tabcontrol. You can simply place a textbox or a richtextbox inside a tabpage and then open the specific file and assign its content to that textbox. This sample code can give you some insight how to open a file and add it to richtextbox in tabpage. Scenerio: First, place a button on the form and OpenFileDialog control, place a richtextbox control inside the tab page and then place the code below for button's click procedure. Then run it and press the button. This sample works for only rtf. extensioned files. :wtf:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click OpenFileDialog1.Filter = "*.rtf|" OpenFileDialog1.RestoreDirectory = True OpenFileDialog1.ShowDialog() If OpenFileDialog1.ShowDialog() = DialogResult.OK Then RichTextBox1.LoadFile(OpenFileDialog1.FileName) End If End Sub
What a curious mind needs to discover knowledge is noting else than a pin-hole.
-
First, I am sorry to say that your english is not good enough because I am confused by your posted messages. You can't add any textbox, label or etc. to tabpage in runtime but tab page to tabcontrol. You can simply place a textbox or a richtextbox inside a tabpage and then open the specific file and assign its content to that textbox. This sample code can give you some insight how to open a file and add it to richtextbox in tabpage. Scenerio: First, place a button on the form and OpenFileDialog control, place a richtextbox control inside the tab page and then place the code below for button's click procedure. Then run it and press the button. This sample works for only rtf. extensioned files. :wtf:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click OpenFileDialog1.Filter = "*.rtf|" OpenFileDialog1.RestoreDirectory = True OpenFileDialog1.ShowDialog() If OpenFileDialog1.ShowDialog() = DialogResult.OK Then RichTextBox1.LoadFile(OpenFileDialog1.FileName) End If End Sub
What a curious mind needs to discover knowledge is noting else than a pin-hole.
JUNEYT wrote:
You can't add any textbox, label or etc. to tabpage in runtime
I'm not exactly sure if adding controls dynamically to the tabpage is required by the OP, but I just wanted to clarify that you certainly can add controls to a tabpage at runtime if required.
-
First, I am sorry to say that your english is not good enough because I am confused by your posted messages. You can't add any textbox, label or etc. to tabpage in runtime but tab page to tabcontrol. You can simply place a textbox or a richtextbox inside a tabpage and then open the specific file and assign its content to that textbox. This sample code can give you some insight how to open a file and add it to richtextbox in tabpage. Scenerio: First, place a button on the form and OpenFileDialog control, place a richtextbox control inside the tab page and then place the code below for button's click procedure. Then run it and press the button. This sample works for only rtf. extensioned files. :wtf:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click OpenFileDialog1.Filter = "*.rtf|" OpenFileDialog1.RestoreDirectory = True OpenFileDialog1.ShowDialog() If OpenFileDialog1.ShowDialog() = DialogResult.OK Then RichTextBox1.LoadFile(OpenFileDialog1.FileName) End If End Sub
What a curious mind needs to discover knowledge is noting else than a pin-hole.
Tnx for you replies but my problem is diffrent. My main program have to have dinamic tabs which i want add tab pages to them. But i want that these tab pages exist in a external class object or every thing that is possible. Like a user defined control. You assume my program have a button that:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If myVar=0 then externalform.visible=true Else form2.visible=true End If End Sub
and this externalform should be imports in header.Means i want to this form be a dll or every thing that is possible.Cause this form change every week. But i donno how i perform this. -
JUNEYT wrote:
You can't add any textbox, label or etc. to tabpage in runtime
I'm not exactly sure if adding controls dynamically to the tabpage is required by the OP, but I just wanted to clarify that you certainly can add controls to a tabpage at runtime if required.