473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

WinForm closed during Windows restart

All,

I have a form that has a text box and button - when the button is
pressed the form will close if the correct text is in the text box -
works fine.

However, if the text box is blank I can't reboot a Windows PC which I
want to allow (if I enter the correct text it will reboot). Is there
anything I can check in the form's OnClosing method to see if Windows
is trying to close the form as opposed to a user closing the form?

Thanks in advance
Oct 9 '08 #1
2 1954
"However, if the text box is blank I can't reboot a Windows PC"
perhaps somehow during shutdown your form keeps waiting an answer,
but, as you dont say anything about your code, I assume that you re using
typical code, with no any reference to special codes that could interfere
with shutdown process, and this means you have something really wrong,
but as you say "if I enter the correct text it will reboot" I have no a clue
what to think about

hope this helps, Carlos.

"Looch" <lu**********@yahoo.comwrote in message
news:bf**********************************@40g2000p rx.googlegroups.com...
All,

I have a form that has a text box and button - when the button is
pressed the form will close if the correct text is in the text box -
works fine.

However, if the text box is blank I can't reboot a Windows PC which I
want to allow (if I enter the correct text it will reboot). Is there
anything I can check in the form's OnClosing method to see if Windows
is trying to close the form as opposed to a user closing the form?

Thanks in advance

Oct 9 '08 #2
On Thu, 09 Oct 2008 12:32:34 -0700, Looch <lu**********@yahoo.comwrote:
All,

I have a form that has a text box and button - when the button is
pressed the form will close if the correct text is in the text box -
works fine.

However, if the text box is blank I can't reboot a Windows PC which I
want to allow (if I enter the correct text it will reboot). Is there
anything I can check in the form's OnClosing method to see if Windows
is trying to close the form as opposed to a user closing the form?
A concise-but-complete code sample that demonstrates the issue might be
helpful. Even with validation, a logout/reboot would normally still
shutdown the application. So you must have some other code that is
somehow blocking that from happening. But without seeing the code, it's
difficult to know what it's doing.

As a general rule, you can use the Application.SessionEnding event to
watch for, and even respond to, scenarios where the user is trying to
logout or the system is trying to reboot. But normally you wouldn't need
to handle that just to deal with a control validation issue; the
validation is skipped altogether during a shutdown. So something else
must be going on. Maybe handling SessionEnding will help you fix it, but
it's not possible to say without more details.

Pete
Oct 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: tonci.tomic | last post by:
I have windows service running on win2000 and client applications on local network connected to service via remoting. Service acts as interface to MSSQL 2000 database and it uses Microsoft Data...
4
by: Alex Bibiano | last post by:
I have a typed dataset in my WinForm and a textbox with databinding to the dataset (all without code). Now, in a button event, I assign a new dataset (retrieved from a function) to the dataset a...
3
by: Ken | last post by:
How can I have my WinForm return something to the caller so it knows which button is clicked? The following is calling a system message box, just want to do the samething with my own winform....
6
by: Leonardo Curros | last post by:
Hello, I would like to know what's the best way to restart one service. I would like to do it from the service itself. Is this possible? I try it with ServiceController.stop()...
7
by: MgGuigg | last post by:
Hello all, This is my first time posting a question to this forum, so here is hoping I am following protocol. I am scraping the rust off my old Basic programming skills, and have just recently...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
6
by: randy1200 | last post by:
I'm using Visual Studio 2005 and C#. I need to print a WinForm used for data entry as a graphic. In other words, I need to print the exact WinForm the user sees on the screen. I searched through...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
2
by: =?Utf-8?B?RnJpZWRoZWxtRWljaGlu?= | last post by:
I am consuming continously my own web-services on a localhost client with a rate of perhaps 35 request/response-pairs a minute. I am using "invoke-id=1", so there is at the same time only one...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.