Results 1 to 3 of 3

Thread: Adding tabpages and controls programmatically

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Chicagoland
    Posts
    92

    Adding tabpages and controls programmatically

    I'm trying to add tabpages and controls on the fly. I can't figure out how to add a control to a tabpage. You'll probably want some code:
    Code:
    Dim InputFile As StreamReader
    Dim InputString As String
    Dim i, x, y As Integer
    
    InputString = InputFile.ReadLine()
    Do Until InputString Is Nothing
        Dim Parts() As String = InputString.Split(",")
        Dim TmpTabPage As New TabPage
        TmpTabPage.Name = Parts(0)
        Me.TabControl1.Controls.Add(TmpTabPage)
        x = 8
        y = 8
    
        Do Until i = Parts.Length
            Dim TmpLbl As New Label
            TmpLbl.Text = Parts(i)
            TmpLbl.Location = New Point(x,y)
            y = y + 40
            ' ????????????????
        Loop
        InputString = InputFile.ReadLine()
    Loop
    The question marks is where I'm stuck. I know I need some kind of Controls.Add method, but I can't find which one. Something like Me.TabControl1.??????.Controls.Add(TmpLbl).

    Any help?

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    VB Code:
    1. tmpTabPage.Controls.Add(tmpLabel)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Chicagoland
    Posts
    92
    Thanks. That did it.

    I knew it was something simple that I was just screwing up.

Posting Permissions

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



Click Here to Expand Forum to Full Width