Results 1 to 4 of 4

Thread: VB question

  1. #1
    Join Date
    Aug 2003
    Posts
    47

    Unanswered: VB question

    Yo

    I can't seem to find a way to declare an array of variables in VB... Only arrays of values.

    Say, on a form I have two text boxes txtBox1 and txtBox2. In the form's VB code I need to have an array that would hold those variables by name.

    (array that holds txtBox1 and txtBox2) then:

    strSomeText = txtBoxes(1) would assign the value of txtBox1 control to this variable and reverse:

    txtBoxes(1) = strSomeText would assign the value of strSomeText to txtBox1 control.

    Any idea anybody?
    F..ck it, gimme a beer... Jimi Hendrix RULES!

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    sup,

    Is this what you're looking for?

    Dim Array1(1) as String
    Array1(0)=txtBox1
    Array1(1)=txtbox2


    (Who's Jimi Handrix?)

    Mark
    Inspiration Through Fermentation

  3. #3
    Join Date
    Aug 2003
    Posts
    47
    OK

    I have figured it out!

    Dim arrTextBoxes
    arrTextBoxes = Array(txtBox1, txtBox2)

    the problem was that by just using a statement:

    arrTextBoxes(1) = strSomeText won't assign the value to the text box. I'm not sure why. But:

    arrTextBoxes(1).Value = strSomeText WORKED!

    thanks any way.
    F..ck it, gimme a beer... Jimi Hendrix RULES!

  4. #4
    Join Date
    Aug 2003
    Posts
    47
    Com'n now Mark.

    You don't know who Jimi Handrix is?!

    Google it.
    F..ck it, gimme a beer... Jimi Hendrix RULES!

Posting Permissions

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