Results 1 to 4 of 4

Thread: An easy question

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    State College, PA
    Posts
    2

    Post An easy question

    How can i initialize VB contorls in a loop, e.g. how do I name a TabPage being created in a loop when I want to create and label an unkown number of them.

    Like so,

    PHP Code:
    2
    For 2 To Pre_WS_Count
    Dim PreWSi 
    As New TabPage()
    PreWSi.Text "PreWS " Str(i))
    etc..
    Next i 
    where I want the i in PreWSi to be a number that corresponds to the loop index. I basically don't know how to get the i to label properly where the desired output is.....

    PreWS1
    PreWS2
    PreWS3
    etc...

  2. #2
    Lively Member
    Join Date
    Jul 2003
    Location
    Kuala Lumpur (Malaysia)
    Posts
    92
    Hi

    i = 2
    For i = 2 To Pre_WS_Count
    Dim PreWSi As New TabPage()
    PreWSi.Text = "PreWS " & i
    myTabControl.TabPage.Add(PreWsi)
    etc..
    Next i

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    State College, PA
    Posts
    2
    So just leaving it as PreWSi will work?

  4. #4
    Lively Member
    Join Date
    Jul 2003
    Location
    Kuala Lumpur (Malaysia)
    Posts
    92

    Smile

    As long as don't forget to add the pages.

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