Results 1 to 7 of 7

Thread: MsgBox Question

  1. #1
    Guest

    Question

    I am somewhat new to VB having only used it about a year now. My question is this, when I generate a message box with the vbYes_No option, is there a way to set the focus to the No option rather than the Yes option that it defaults to?

  2. #2
    Guest
    This should work:

    Code:
    SendKeys "{TAB}"
    YesNo = MsgBox("Yes/No?", 4 + 32)

  3. #3
    Guest

    Talking

    Thanks that worked great! And so simple too.

  4. #4
    Guest
    Or use
    MsgBox "Yes/No with default as No", vbYesNo + vbDefaultButton2

  5. #5
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    This will also work:
    Code:
    MsgBox "Hello", vbYesNo + vbDefaultButton2, "Hello"
    Sorry Sarun, we posted at the same time
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  6. #6
    New Member
    Join Date
    Dec 2000
    Location
    MN
    Posts
    2

    Question Follow-up question

    I am using a vbYesNo message box that I really want my users to pay attention to. Thus, I don't want a default button or they will just hit enter and cruise right bye. I have tried setting the default to a non-existent 3rd button but it still stayed at the first button.
    1st - 0
    2nd - 256
    3rd - 512

  7. #7
    Guest

    Wink

    what I would do would be build a simple form with a label, and two command buttons (yes and no) If you build this right the end user would not notice the difference between the a message box and a form. The trick is you can set up a very small text box (possibly not visible, alothough I don't remember if it can recieve focus if it is not visible) with background and borders set to clear. Then put the focus in this box. That way your end user has to select whether it is yes or no.

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