Results 1 to 6 of 6

Thread: [RESOLVED] Declaring A Variable In Combobox

  1. #1

    Thread Starter
    Member devil_jin's Avatar
    Join Date
    Feb 2006
    Location
    USA
    Posts
    44

    Resolved [RESOLVED] Declaring A Variable In Combobox

    Say that i have this
    Code:
    Dim Stuff As String
    Stuff = "Write things here to declare stuff"
    
    Private Sub Command1_Click()
    Combo1.Additem "Stuff", 0
    Final = "There Are" & Combo1.Text & "Balls In The Toy THingy"
    Text1.Text = Final
    End Sub
    I want the variable stuff to show instead of the text like instead of
    Final = "There Are" & "Stuff" & "Balls In The Toy THingy"

    I want the variable of stuff

    Final = "There Are" & Write things here to declare stuff & "Balls In The Toy THingy"

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Declaring A Variable In Combobox

    VB Code:
    1. Private Sub Form_Load()
    2. Dim Stuff As String
    3. Dim Final As String
    4.  
    5. Stuff = "Write things here to declare stuff"
    6.  
    7. Combo1.AddItem "" & Stuff & "", 0
    8.  
    9. Final = "There Are " & Combo1.Text & " Balls In The Toy THingy"
    10. Text1.Text = Final
    11.  
    12. End Sub

  3. #3
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Declaring A Variable In Combobox

    The code that Lintz posted should work. But I want to comment on this line:

    Combo1.Additem "Stuff", 0

    Why would you put quotation marks around a variable name??? That is your problem.

  4. #4
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Declaring A Variable In Combobox

    That's why he was asking for help baja_yu

  5. #5

    Thread Starter
    Member devil_jin's Avatar
    Join Date
    Feb 2006
    Location
    USA
    Posts
    44

    Re: Declaring A Variable In Combobox

    I tryed it and all it shows in the combobox True?

  6. #6

    Thread Starter
    Member devil_jin's Avatar
    Join Date
    Feb 2006
    Location
    USA
    Posts
    44

    Re: Declaring A Variable In Combobox

    Ook i see what i did wrong it does work :P

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