Close

Results 1 to 6 of 6
  1. #1
    DF Rookie candigirl90's Avatar
    Join Date
    Feb 2004
    Location
    Staffordshire
    Posts
    6
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default Visual Stdio.Net MsgBox help

    Hello!

    On the message box option I have already typed the following for a 'quit' button:

    MsgBox("Are you sure that you want to exit the programme?",MsgBoxStyle.YesNo,"Exiting the programme",

    If yes is clicked I would like the progamme to close, if no is clicked I would like the user to go back to the programme.

    How do I do this? Can anyone help please?

    Thanyou

    Candice xx

  2. #2
    DF PiMP graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    262
    Thanks
    0
    Thanked:        0
    Karma Level
    255

    Default Re: Visual Stdio.Net MsgBox help

    This will do it, assuming its a Windows application

    Dim MsgReply As Integer = MsgBox("Are you sure that you want to exit the programme?", MsgBoxStyle.YesNo, "Exiting the programme")

    If MsgReply = MsgBoxResult.Yes Then
    System.Environment.Exit(0)
    End If


    Quote Originally Posted by candigirl90
    Hello!

    On the message box option I have already typed the following for a 'quit' button:

    MsgBox("Are you sure that you want to exit the programme?",MsgBoxStyle.YesNo,"Exiting the programme",

    If yes is clicked I would like the progamme to close, if no is clicked I would like the user to go back to the programme.

    How do I do this? Can anyone help please?

    Thanyou

    Candice xx

  3. #3
    DF PlaYa salvadorescobar's Avatar
    Join Date
    Dec 2000
    Location
    Huddersfield
    Posts
    951
    Thanks
    0
    Thanked:        0
    Karma Level
    311

    Default Re: Visual Stdio.Net MsgBox help

    Don't forget that you might want to do a little clean up just before you exit the application!

  4. #4
    DF PiMP graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    262
    Thanks
    0
    Thanked:        0
    Karma Level
    255

    Default Re: Visual Stdio.Net MsgBox help

    very true, although on medium to simple .net applications that garbage collector will clean up after you... although.. when it comes down to it, its always best to close/deallocate everything you use....

  5. #5
    DF PiMP empo's Avatar
    Join Date
    Apr 2001
    Location
    Scrump-ee Land
    Posts
    253
    Thanks
    0
    Thanked:        0
    Karma Level
    257

    Default Re: Visual Stdio.Net MsgBox help

    so whats the difference between System.Environment.Exit(0) and Me.Close()

  6. #6
    DF PiMP graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    262
    Thanks
    0
    Thanked:        0
    Karma Level
    255

    Default Re: Visual Stdio.Net MsgBox help

    Quote Originally Posted by empo
    so whats the difference between System.Environment.Exit(0) and Me.Close()

    Me.Close() will close the form it has been coded in, if this is the only form open in the app, then the app will finish

    System.Environment.Exit(0) will close all forms and exit the system.

Similar Threads

  1. Audio Visual by me.
    By Bilbo_baggin in forum Your Photos & Artwork
    Replies: 11
    Last Post: 25th February 2011, 10:49 AM
  2. Visual Boy Advance 360 v0.03
    By Raptor in forum Microsoft Consoles
    Replies: 1
    Last Post: 15th June 2010, 06:38 PM
  3. Visual Amusement
    By headsortails in forum Funny Pictures
    Replies: 9
    Last Post: 24th January 2007, 03:17 AM
  4. Visual Basic + MSN
    By Spennyboy in forum The Dog and Duck
    Replies: 7
    Last Post: 9th August 2004, 11:33 PM
  5. Visual C++ Help
    By Tectona in forum Programming
    Replies: 6
    Last Post: 14th April 2003, 02:18 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •