Results 1 to 4 of 4

Thread: msgbox option

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    msgbox option

    im trying to do something like

    VB Code:
    1. Private Sub Command1_Click()
    2. 'msgbox here asking 'are you sure you want to remove the file with yes/no button, if yes is click, then Kill "C:\test.txt", otherwise Form7.close
    3. End Sub

    any ideas how it can be done guys?

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: msgbox option

    VB Code:
    1. Private Sub Command1_Click()
    2.     If MsgBox("Are you sure you want to remove the file?", vbYesNo + vbQuestion) = vbYes Then
    3.         Kill "c:\test.txt"
    4.     Else
    5.         Unload Form7
    6.     End If
    7. End Sub

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: msgbox option

    VB Code:
    1. Private Sub Command1_Click()
    2.     'msgbox here asking 'are you sure you want to remove the file with yes/no button, if yes is click, then Kill "C:\test.txt", otherwise Form7.close
    3.     If vbYes = MsgBox("Are you sure you want to remove the file?", vbYesNo + vbQuestion) Then
    4.         Kill "C:\test.txt"
    5.     Else
    6.         Unload Form7
    7.     End If
    8. End Sub
    9.  
    10. EDIT:
    11. Joacim wins  :D
    Last edited by Pradeep1210; Sep 22nd, 2005 at 03:42 PM.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  4. #4
    Hyperactive Member vincentg's Avatar
    Join Date
    Jun 2005
    Location
    Chicago IL, USA
    Posts
    261

    Re: msgbox option

    I dont know what you mean... Hope am right with this one.

    VB Code:
    1. Dim lnAns as Integer
    2.  
    3. lnAns = Msgbox ("Is this are you looking for?",vbYesNo + vbQuestion)
    4.  
    5. If lnAns = 7 'No
    6.   .....<process something>
    7. Else
    8.    .....<process something>
    9. 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