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 VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    290

    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 VIP Member salvadorescobar's Avatar
    Join Date
    Dec 2000
    Location
    Huddersfield
    Posts
    951
    Thanks
    0
    Thanked:        0
    Karma Level
    346

    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!
    'If we aren't meant to eat animals, then why are they made out of meat?'
    Anon.

  4. #4
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    290

    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 VIP Member empo's Avatar
    Join Date
    Apr 2001
    Location
    Scrump-ee Land
    Posts
    253
    Thanks
    0
    Thanked:        0
    Karma Level
    292

    Default Re: Visual Stdio.Net MsgBox help

    so whats the difference between System.Environment.Exit(0) and Me.Close()
    when i die i wanna be buried face down so everyone can kiss my arse ! :kissass

  6. #6
    DF VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    290

    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. Wanted: Visual Basic Latest/Full Edition
    By Ttocs in forum Buy, Sell and Trade
    Replies: 0
    Last Post: 21st November 2002, 02:35 PM
  2. Visual Basic 6
    By Digi Program in forum Website Coding & Graphics
    Replies: 2
    Last Post: 15th October 2002, 08:11 PM
  3. Visual Studio.net PROBLEM
    By manOFice in forum PC Software
    Replies: 1
    Last Post: 17th September 2002, 02:02 AM
  4. visual basic 6 enterprise
    By spade2001 in forum Programming
    Replies: 21
    Last Post: 14th September 2002, 10:51 AM
  5. Visual basic Any one!
    By magic1 in forum The Dog and Duck
    Replies: 2
    Last Post: 8th September 2002, 02:05 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
  •