Results 1 to 3 of 3

Thread: Question on message box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    west
    Posts
    96

    Question on message box

    Hi everybody

    I would like to ask everybody a question.........the code belows shown as:


    Dim dlgRes As DialogResult
    dlgRes = MessageBox.Show( _
    "Are you sure you want to overwrite the entries", _
    "Mp500", _
    MessageBoxButtons.YesNo, _
    MessageBoxIcon.Question)

    If dlgRes = DialogResult.No Then
    Application.Exit()

    the code above shown that if the user click "No", the whole application is exit.........but i do not want this to happen...........i just want:if the user click "no", it will only exit the message box and does nothing.........may i know how to do this ?...........thank u very much............

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Question on message box

    remove the application.exit()

  3. #3
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    384

    Re: Question on message box

    Well, I would just include a test then for the Yes Value
    VB Code:
    1. Dim dlgRes As DialogResult
    2. dlgRes = MessageBox.Show( _
    3. "Are you sure you want to overwrite the entries", _
    4. "Mp500", _
    5. MessageBoxButtons.YesNo, _
    6. MessageBoxIcon.Question)
    7.  
    8. If dlgRes = DialogResult.Yes Then
    9. Do what you want and don't include else for No
    10. End If

    Or
    Exit Sub ¿
    VB Code:
    1. Dim dlgRes As DialogResult
    2. dlgRes = MessageBox.Show( _
    3. "Are you sure you want to overwrite the entries", _
    4. "Mp500", _
    5. MessageBoxButtons.YesNo, _
    6. MessageBoxIcon.Question)
    7.  
    8. If dlgRes = DialogResult.No Then
    9. Exit Sub
    10. End If

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