Click here to Skip to main content
16,013,489 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Prevent Logoff in Vb.net Pin
Legion988915-Oct-07 14:53
Legion988915-Oct-07 14:53 
GeneralRe: Prevent Logoff in Vb.net Pin
Dave Kreskowiak15-Oct-07 17:22
mveDave Kreskowiak15-Oct-07 17:22 
GeneralRe: Prevent Logoff in Vb.net Pin
Legion988916-Oct-07 4:16
Legion988916-Oct-07 4:16 
GeneralRe: Prevent Logoff in Vb.net Pin
Dave Kreskowiak16-Oct-07 4:25
mveDave Kreskowiak16-Oct-07 4:25 
GeneralRe: Prevent Logoff in Vb.net [modified] Pin
Legion988916-Oct-07 5:51
Legion988916-Oct-07 5:51 
GeneralRe: Prevent Logoff in Vb.net Pin
Dave Kreskowiak16-Oct-07 6:47
mveDave Kreskowiak16-Oct-07 6:47 
GeneralRe: Prevent Logoff in Vb.net Pin
Legion988916-Oct-07 7:54
Legion988916-Oct-07 7:54 
GeneralRe: Prevent Logoff in Vb.net Pin
Patrick Etc.16-Oct-07 7:55
Patrick Etc.16-Oct-07 7:55 
Dave Kreskowiak wrote:
The FormClosing event could fire first, unhooking the SessionEnding event handler, then the SessionEnding event could fire.


One simple solution to this is have the SessionClosing event be static to the class. The class could simply maintain a static variable that indicates if it's ok to shut down, which the instance class can set to true/false (and of course you can get as complex here as you like, including other variables to explain what's going on, etc.).

Then, the handler can be wired and unwired in the main application code where Application.Run is called, instead of needing to do it inside the form. This way, you don't need to worry about the form's lifetime, only your application's.


"If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual."
- Frank Herbert

GeneralRe: Prevent Logoff in Vb.net Pin
Dave Kreskowiak16-Oct-07 8:35
mveDave Kreskowiak16-Oct-07 8:35 
GeneralRe: Prevent Logoff in Vb.net Pin
Patrick Etc.16-Oct-07 12:27
Patrick Etc.16-Oct-07 12:27 
GeneralRe: Prevent Logoff in Vb.net Pin
Dave Kreskowiak16-Oct-07 12:29
mveDave Kreskowiak16-Oct-07 12:29 
GeneralRe: Prevent Logoff in Vb.net Pin
Patrick Etc.16-Oct-07 15:03
Patrick Etc.16-Oct-07 15:03 
GeneralRe: Prevent Logoff in Vb.net Pin
Legion988917-Oct-07 4:49
Legion988917-Oct-07 4:49 
QuestionGet array from DGV column Pin
cstrader23215-Oct-07 11:46
cstrader23215-Oct-07 11:46 
AnswerRe: Get array from DGV column Pin
Dave Kreskowiak15-Oct-07 12:20
mveDave Kreskowiak15-Oct-07 12:20 
QuestionHow can I send command line and read the responses? Pin
ATC15-Oct-07 10:04
ATC15-Oct-07 10:04 
AnswerRe: How can I send command line and read the responses? Pin
Dave Kreskowiak15-Oct-07 10:09
mveDave Kreskowiak15-Oct-07 10:09 
AnswerRe: How can I send command line and read the responses? Pin
DigiOz Multimedia15-Oct-07 10:18
DigiOz Multimedia15-Oct-07 10:18 
GeneralRe: How can I send command line and read the responses? Pin
ATC15-Oct-07 10:29
ATC15-Oct-07 10:29 
GeneralRe: How can I send command line and read the responses? Pin
DigiOz Multimedia15-Oct-07 10:35
DigiOz Multimedia15-Oct-07 10:35 
GeneralRe: How can I send command line and read the responses? [modified] Pin
ATC16-Oct-07 4:24
ATC16-Oct-07 4:24 
GeneralRe: How can I send command line and read the responses? Pin
DigiOz Multimedia16-Oct-07 9:04
DigiOz Multimedia16-Oct-07 9:04 
GeneralRe: How can I send command line and read the responses? Pin
ATC16-Oct-07 9:42
ATC16-Oct-07 9:42 
Questionadding .cpp file in vb.net Pin
manni_n15-Oct-07 8:44
manni_n15-Oct-07 8:44 
AnswerRe: adding .cpp file in vb.net Pin
DigiOz Multimedia15-Oct-07 9:57
DigiOz Multimedia15-Oct-07 9:57 

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.