CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    91

    simple input box question

    I am using input box to take a string value from user, and assigning it to a string variable. But How can I know that a user has pressed OK or Cancel. If the user presses the canel button, the partial default string shown in the textbox of the inputbox is accepted as a valid input which it shouldn't.
    HOw can I detect OK & Cancel Buttons?

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: simple input box question

    Create your own form. InputBox is useless.

  3. #3
    Join Date
    Dec 2003
    Location
    St. Cugat - Catalunya
    Posts
    441

    Re: simple input box question

    arshadjehan,
    InputBox returns a zero length string when cancel button is pressed. Nor any partial input string, neither the default string.

    You can test YourString.Length for zero.

    The only case you will not be able to deal with is a OK button without any input, wich also will return a zero length string.

    Hope it helps
    Did it help? rate it.

    The best conversation I had was over forty million years ago ... and that was with a coffee machine.

  4. #4
    Join Date
    Dec 2003
    Posts
    91

    Re: simple input box question

    Thanks...

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

Featured