Results 1 to 7 of 7

Thread: InputBox problem. Need Help!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122

    Question InputBox problem. Need Help!

    By using the following code, when I click on the CommandButton, it opens a second Form2 and also an InputBox.
    The problem is that, when I click OK on the InputBox it is called again. Only after I close it a second time, it makes what I want: to put the text on a label on the second form.
    Where am I wrong? Here's the code.

    Option Explicit
    Dim Notes As String
    _____________________________________________________________________

    Private Sub Command1_Click()
    Form2.Show
    Form2.Picture1.Picture = Command1.Picture
    Notes = InputBox("Introduza o texto para esta nota do RoadBook")
    If Form2.Visible = True Then
    InputBox ("Introduza o texto para esta nota do RoadBook")
    End If
    Form2.Label1.Caption = Notes
    End Sub

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258
    What Are you trying to do.
    You are calling two times the inputbox Thats why its displayed two times.


    Private Sub Command1_Click()
    Form2.Show
    Form2.Picture1.Picture = Command1.Picture
    Notes = InputBox("Introduza o texto para esta nota do RoadBook")
    If Form2.Visible = True Then
    InputBox ("Introduza o texto para esta nota do RoadBook")
    End If
    Form2.Label1.Caption = Notes
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Thanks for you reply shragel.

    I want to put the "input text" on a label, on the Form2 (when I click OK on the inputbox, the text appears inside the label).
    I think I need to declare a variable [notes = InputBox("Introduza o texto para esta nota do RoadBook")] so that I can insert the text inside the label (Form2.Label1.Caption = Notes).

    Maybe this is wrong.

    Can I use Form2.Label1.Caption = InputBox("Introduza o texto para esta nota do RoadBook")? This won't call the InputBox a second time again? How can I avoid that?

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command1_Click()
    Form2.Show
    Form2.Picture1.Picture = Command1.Picture
    Notes = InputBox("Introduza o texto para esta nota do RoadBook")
     'you don't need this cause you just make form2 visible with Form2 Show
    'If Form2.Visible = True Then
    'InputBox ("Introduza o texto para esta nota do RoadBook")
    'End If
    Form2.Label1.Caption = Notes
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Thanks for you reply Joe (may I call you just Joe?)

    So you mean:

    Private Sub Command1_Click()
    Form2.Show
    Form2.Picture1.Picture = Command1.Picture
    InputBox ("Introduza o texto para esta nota do RoadBook")
    Form2.Label1.Caption = InputBox ("Introduza o texto para esta nota do RoadBook")
    End Sub


    Is this correct?

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    No & No
    You can call me Wayne

    & This will do.
    Code:
    Private Sub Command1_Click()
     Form2.Show
     Form2.Picture1.Picture = Command1.Picture
     Form2.Label1.Caption = InputBox("Introduza o texto para esta nota do RoadBook")
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2001
    Location
    Lisbon
    Posts
    122
    Ok, I see what you mean.

    Thanks for your help, Joe Wayne (sorry for that, I could not resist)

    Thanks again.

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