PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Adding MultiTab with Textbox inside.-VBForums
Results 1 to 6 of 6

Thread: Adding MultiTab with Textbox inside.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2011
    Posts
    200

    Adding MultiTab with Textbox inside.

    I am wondering how to add a tab control that adds new tabs and a textbox inside when creating new file, and the ability to close file. Kind of like what you would see in word processing programs. As long as I know how to add the tabs dynamically with the textbox inside im sure I could figure the rest out.

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,681

    Re: Adding MultiTab with Textbox inside.

    Start a new project, add a TabControl and a Button and put this as your Form code:-
    vbnet Code:
    1. Public Class Form1
    2.  
    3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    4.         Dim newPage As New TabPage("My Tab " + CStr(TabControl1.TabPages.Count + 1))
    5.         Dim tb As New TextBox
    6.  
    7.         tb.Width = 100
    8.         tb.Height = 16
    9.         tb.Left = 0
    10.         tb.Top = 10
    11.  
    12.  
    13.         newPage.Controls.Add(tb)
    14.  
    15.         TabControl1.TabPages.Add(newPage)
    16.  
    17.     End Sub
    18. End Class

    Run the program and click the Button.....Is that what you want ?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2011
    Posts
    200

    Re: Adding MultiTab with Textbox inside.

    Thanks Niya.

    I am having a problem. How do I access the textbox on the selectedtab.

    I am trying to send all information from current tab textbox to listbox.

    vb Code:
    1. Dim splitcode() As String = tb.Text.Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
    2.  
    3.         For i = 0 To splitcode.Length - 1
    4.             PlayEvents.ListView1.Items.Add(New ListViewItem({i.ToString, splitcode(i)}))
    5.         Next

    Another example is when I am saving the file. I thought it was something like. Is it different because the textbox is added at runtime?

    vb Code:
    1. tabcontrol1.selectedtab(tb)

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,569

    Re: Adding MultiTab with Textbox inside.

    I am having a problem. How do I access the textbox on the selectedtab
    I think what you may be referring to is the add handler. At first, I thought of it to be quite tricky, but after fooling around with it, it came to me.
    I am trying to send all information from current tab textbox to listbox.
    To get the string from a textbox in a certain tabpage I would do something like this:
    Code:
    Dim tbpage As TabPage = TabPage1
            For Each txt As TextBox In tbpage.Controls.OfType(Of TextBox)()
                If txt.Text <> String.Empty Then
                    'Insert code here
                    Dim str() As String = txt.Text.Split(CChar(Environment.NewLine))
                    For i As Integer = str.Count - 1 To 0 Step -1
                        ListBox1.Items.Add(str(i))
                    Next
                End If
            Next
    Another example is when I am saving the file. I thought it was something like. Is it different because the textbox is added at runtime?
    huh?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2011
    Posts
    200

    Re: Adding MultiTab with Textbox inside.

    Thanks for the responses. Dday, how do I modify that code so it adds the selected tab page, not just tabpage1?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2011
    Posts
    200

    Re: Adding MultiTab with Textbox inside.

    Nevermind, I got it lol.

    vb Code:
    1. Dim tbpage As TabPage = TabControl1.SelectedTab

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width