Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Insert tab pages dinamically to a tab control

Insert tab pages dinamically to a tab control

Scheduled Pinned Locked Moved Visual Basic
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Narenge
    wrote on last edited by
    #1

    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.

    J 1 Reply Last reply
    0
    • N Narenge

      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.

      J Offline
      J Offline
      JUNEYT
      wrote on last edited by
      #2

      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.

      N 1 Reply Last reply
      0
      • J JUNEYT

        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.

        N Offline
        N Offline
        Narenge
        wrote on last edited by
        #3

        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.

        J 1 Reply Last reply
        0
        • N Narenge

          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.

          J Offline
          J Offline
          JUNEYT
          wrote on last edited by
          #4

          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.

          T N 2 Replies Last reply
          0
          • J JUNEYT

            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.

            T Offline
            T Offline
            TwoFaced
            wrote on last edited by
            #5

            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.

            J 1 Reply Last reply
            0
            • J JUNEYT

              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.

              N Offline
              N Offline
              Narenge
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • T TwoFaced

                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.

                J Offline
                J Offline
                JUNEYT
                wrote on last edited by
                #7

                Yes you are right! I made a mistake in adding it to tabcontrol not tab page. Dim myt as new textbox TabControl1.TabPages(0).Controls.Add(myt) is working... Thanks.

                What a curious mind needs to discover knowledge is noting else than a pin-hole.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups