Development vb inputbox

Discussion in 'Software' started by ahug4122, 30 Nov 2004.

  1. ahug4122

    ahug4122 What's a Dremel?

    Joined:
    16 Sep 2004
    Posts:
    60
    Likes Received:
    0
    hey guys

    if i have a inputbox

    input1 = inputbox("pop")
    how do i use that value
    eg like if input1 = (something) then
    something else
    i keep on getting a error
     
  2. laoda

    laoda What's a Dremel?

    Joined:
    27 Nov 2004
    Posts:
    35
    Likes Received:
    0
    What error are you getting? Can you post your code as you have it written?
     
  3. ahug4122

    ahug4122 What's a Dremel?

    Joined:
    16 Sep 2004
    Posts:
    60
    Likes Received:
    0
    Code:
    Private Sub Form_Load()
    in1 = InputBox("how are you", "good or bad", , 500, 500)
        If in1 = "good" Then
            MsgBox "thats great"
        Else
            MsgBox "not so great"
        End If
    End Sub
    
    all i want is to be able to is read the value in in1 (inputbox1)
     
  4. ahug4122

    ahug4122 What's a Dremel?

    Joined:
    16 Sep 2004
    Posts:
    60
    Likes Received:
    0
    Code:
    Private Sub Form_Load()
    in1 = InputBox("how are you", "good or bad", , 500, 500)
        If in1 = "good" Then
            MsgBox "thats great"
        Else
            MsgBox "not so great"
        End If
    End Sub
    
    all i want is to be able to is read the value in in1 (inputbox1)
    plz tH4ñx
     
  5. djengiz

    djengiz Pointless.

    Joined:
    16 Aug 2002
    Posts:
    1,129
    Likes Received:
    0
    You got MSDN? It has a good example in it. type inputbox and use F1 for MSDN
     
  6. Hepath

    Hepath Minimodder

    Joined:
    20 Oct 2003
    Posts:
    730
    Likes Received:
    0
    OK,
    Assuming your using VB6 and a standard vanilla windows executable (you've pasted a Form_Load so I'm guessing it is) the only error that would produce is a syntax error stating in1 is undefined.

    add:
    Dim in1 as string

    as the first line after the function declaration and you should be fine. Its all down to the fact that option explicit will be declared (which you should really always have.)
     
  7. ahug4122

    ahug4122 What's a Dremel?

    Joined:
    16 Sep 2004
    Posts:
    60
    Likes Received:
    0
    thank you guys i can't belive it is as easy as a dim statment you guys rock i got 95% for my test now you rock
     

Share This Page