473,770 Members | 6,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1965
"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**********@y ahoo.comwrote in message
news:bf******** *************** ***********@40g 2000prx.googleg roups.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**********@y ahoo.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.Ses sionEnding 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
2138
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 Application Block. Every few days data block throws timeout exception during the insert (and very rarely even during select). After that every subsequent insert from any client, even from client residig on the same machine as service, throws the...
4
15977
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 had in the form, but the textbos isn't refreshed. Exemple code from my button click event: dataset1 = helper.GetUser(6);
3
2837
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. Thanks. If MsgBox("Data added.", MsgBoxStyle.OKCancel, "Message") = MsgBoxResult.OK Then ' do something End If
6
3807
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() ServiceController.WaitForStatus(ServiceControllerStatus.Stopped) ServiceController.start() but doesn´t works. It seems waitforstatus instruction is the last
7
2578
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 upgraded to VB.NET, and I have a lot of catching up to do. That being said, I have come a long way in a short while, however, I am stumped at the moment. I have read through days of posts, but have not been able to address my specific question, so...
26
16527
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 Win2K3/IIS6.0), do we still need this patch? 2) Does it specifically solve only this error: The underlying connection was closed. An unexpected error
6
14922
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 the newsgroups, and found the code below. This seems reasonable, except for the fact that the author does not provide his SetSeq_Library. This is needed to load the Bitmap variable _ActiveFormImage. Any suggestions on how to capture a WinForm...
1
6068
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 during the runtime, the user can click on a button and change the connection string without exiting the application. I would really appreciate any sort of help.
2
2278
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 request pending. After a runtime of 4 days I get the system.net.exception "The underlying connection was closed: An unexpected error occured on a send" Subsequent ws-calls in this state result also in the same exception, browsing a local hosted...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.