Results 1 to 7 of 7

Thread: InputBox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    118
    I am lost on this. I need to add what is added in an InputBox to a textbox on a form and to a field in a database. I want to have OK and Cancel. How can I check for Cancel and get the value?
    Code:
    Dim iResponse As Integer
    iResponse = InputBox "Add Note"
    If iResponse = 1 Then 'user hit Ok
          'this will check for the cancel but how do I get 
          'the data entered
    Dim strNote As String
    strNote = InputBox("Enter Note for"  & ListView1.SelectedItem, "Add Note")
         'this get the data but not the Cancel
         'How do I do this?
    Kokopeli
    VB6 SP3

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092

    add an if...

    Code:
    if (strNote <> "") then
    'whatever
    end if
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Guest
    Code:
    Dim iResponse As Integer
    iResponse = InputBox "Add Note"
    If iResponse = 1 Then 'user hit Ok
          'this will check for the cancel but how do I get 
          'the data entered
    Dim strNote As String
    strNote = InputBox("Enter Note for"  & ListView1.SelectedItem, "Add Note")
    If strNote = "" Then Msgbox "Nothing entered!", vbCritical
    '....

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    118

    only one inputbox

    I may have made my question a little confusing. I only want one InputBox to show up. I need to know if I can check the button and get the string. If not I can work around it. I just wanted to check the cancel button in case the user entered something then changed thier mind.
    Kokopeli
    VB6 SP3

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092
    if the user hits cancel, the string will be empty, so mine, or Matthew's code will work.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6
    Guest
    I see what you want.

    Code:
    x = InputBox("How are you today?")
    If x <> "" Then
    Msgbox "Response: " & x
    Else
    Msgbox "Not having a good day?"
    End If

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

    <?>

    this is all you need.
    Dim strNote As String
    strNote = InputBox("Enter Note for" & ListView1.SelectedItem, "Add Note")

    If strNote = "" Then
    MsgBox "You either picked nothing or pressed cancel"
    Exit Sub
    End If
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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