Click here to Skip to main content
15,920,217 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralGeneric Custom Data Source For Data Grid Pin
toddmo5-Aug-04 7:47
toddmo5-Aug-04 7:47 
Questionhow can I close .exe in multiple forms? Pin
Lisana5-Aug-04 4:59
Lisana5-Aug-04 4:59 
AnswerRe: how can I close .exe in multiple forms? Pin
Colin Angus Mackay5-Aug-04 6:05
Colin Angus Mackay5-Aug-04 6:05 
GeneralRe: how can I close .exe in multiple forms? Pin
Lisana5-Aug-04 6:45
Lisana5-Aug-04 6:45 
GeneralRe: how can I close .exe in multiple forms? Pin
Lisana5-Aug-04 8:01
Lisana5-Aug-04 8:01 
GeneralRe: how can I close .exe in multiple forms? Pin
Colin Angus Mackay5-Aug-04 10:15
Colin Angus Mackay5-Aug-04 10:15 
GeneralRe: how can I close .exe in multiple forms? Pin
Lisana5-Aug-04 10:44
Lisana5-Aug-04 10:44 
GeneralRe: how can I close .exe in multiple forms? Pin
Colin Angus Mackay5-Aug-04 10:56
Colin Angus Mackay5-Aug-04 10:56 
By the looks of it you would call the Application.Exit() from within the event handler, as this code is asking the user if they are sure that they want to exit.

Your event handler might look something like this:
Private Sub FormClosing(ByVal sender As System.Object, ByVal e As 
                        System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

    If MessageBox.Show("Are you sure to exit?", "Exit", MessageBoxButtons.YesNo,
                       MessageBoxIcon.Question) = DialogResult.Yes Then
        Application.Exit()
    Else
        e.Cancel = True
    End If

End Sub


It will ask the user if they are sure they want to exit the application, and if they choose yes the Application will exit. IIRC no further events will be handled and definitely the Closed and Closing events of the other forms will not get raised.

Does this clear everything up?


"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!


GeneralRe: how can I close .exe in multiple forms? Pin
Lisana5-Aug-04 11:04
Lisana5-Aug-04 11:04 
GeneralRe: how can I close .exe in multiple forms? Pin
Colin Angus Mackay5-Aug-04 13:29
Colin Angus Mackay5-Aug-04 13:29 
Generalmore on environment variables Pin
madfiddlerchris5-Aug-04 4:18
madfiddlerchris5-Aug-04 4:18 
GeneralRe: more on environment variables Pin
Dave Kreskowiak5-Aug-04 7:29
mveDave Kreskowiak5-Aug-04 7:29 
GeneralRe: more on environment variables Pin
madfiddlerchris25-Aug-04 0:31
madfiddlerchris25-Aug-04 0:31 
GeneralRe: more on environment variables Pin
Dave Kreskowiak26-Aug-04 1:33
mveDave Kreskowiak26-Aug-04 1:33 
GeneralRe: more on environment variables Pin
madfiddlerchris26-Aug-04 2:10
madfiddlerchris26-Aug-04 2:10 
GeneralRe: more on environment variables Pin
Dave Kreskowiak27-Aug-04 17:56
mveDave Kreskowiak27-Aug-04 17:56 
GeneralRemoving Flicker in an scrolling image Pin
VVision5-Aug-04 3:48
VVision5-Aug-04 3:48 
GeneralRe: Removing Flicker in an scrolling image Pin
Gary Shel18-Aug-04 12:07
Gary Shel18-Aug-04 12:07 
GeneralUnspecified Error using .NET System.DirectoryServices on Windows NT Pin
Rahsas5-Aug-04 3:20
Rahsas5-Aug-04 3:20 
GeneralRe: Unspecified Error using .NET System.DirectoryServices on Windows NT Pin
Rahsas5-Aug-04 8:51
Rahsas5-Aug-04 8:51 
GeneralCreating multiple forms Pin
Simon Kearn5-Aug-04 0:19
sussSimon Kearn5-Aug-04 0:19 
GeneralRe: Creating multiple forms Pin
Jim Matthews5-Aug-04 3:49
Jim Matthews5-Aug-04 3:49 
GeneralRe: Creating multiple forms Pin
Simon Kearn5-Aug-04 4:21
sussSimon Kearn5-Aug-04 4:21 
GeneralRe: Creating multiple forms Pin
Dave Kreskowiak5-Aug-04 5:33
mveDave Kreskowiak5-Aug-04 5:33 
GeneralRe: Creating multiple forms Pin
Simon Kearn5-Aug-04 6:07
sussSimon Kearn5-Aug-04 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.