Results 1 to 2 of 2

Thread: another one :P

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Posts
    35

    another one :P

    hello again

    just wondering how to create variable names that contain a variable

    example

    var1
    var2
    var3
    var4

    how would you create these names on the fly if the number was a variable?

    J

    i was thinking something like

    dim i as integer = 0
    For i = 1 To 10
    dim var+(i) as string = "new variable"
    next

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You don't, you use an array:

    VB Code:
    1. Dim var() As String
    2. Dim cnt As Short=10
    3.  
    4. ReDim var(cnt)
    5.  
    6. For i = 1 To 10
    7.    var(i)= "new variable"
    8. Next

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