Forms :: Detecting MDI Application Shutdown?

May 25, 2009

I typically prompt the user to save changes in the FormClosing event in MDI children. The application updater uses a Process.CloseMainWindow call to close the application if it's running before the patch update is applied.

I need to detect when the updater is closing the application and NOT prompt the user to save changes but save them automatically. I've tried using the System.Windows.Forms.CloseReason but this method isn't working for me. I capture the CloseReason in the MDI Parent FormClosing event but it's called AFTER the MDI children are told to close. I tried capturing the CloseReason (e.CloseReason) in the MDI child's FormClosing event but it registers as MDI Parent closing and a normal application exit is also going to raise this same e.CloseReason so I can't auto-save here either.

So my question is: How can I detect this Process.CloseMainWindow being used to close my application so that I can bypass all save prompts and save automatically? What is the first event called in this method of closing so that I can signal all MDI children that are open in their FormClosing event to just save?

View 1 Replies


ADVERTISEMENT

Detecting Shutdown, Logoff, Restart, Sleep

Dec 25, 2007

What i wish to find is a message or the like that I can use to detect between specific 'shutdown' like events, ie: I wish to be able to find the difference between a shutdown, restart, logoff and sleep initiation.

The problem i have found (as displayed below) is using oClosingEvent.CloseReason the return types provide no further information other then the WindowsShutDown constant (the others are obviously irrelevant in this case).

Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim oClosingEvent As System.Windows.Forms.FormClosingEventArgs

[Code]....

View 9 Replies

Forms - Timer Program Shutdown

Mar 9, 2009

Alright im trying to make it where in Visual Basic 2008 you click on a box ether 10, 20, or 30. Then that tells a timer that the program needs to turn off in 10, 20, or 30 minutes. What I basically want it to do is, whenever the set amount time is when it goes off it shows form1(login form). I have prepared a picture can anyone supply me with some information on how to do this?

View 14 Replies

Forms :: Save Data Before Shutdown / Reboot?

Nov 5, 2009

I've got a small reminder application I wrote in VB Express 2008. The main app autostarts with Windows and sits in the system tray all the time. Now, I need to save the time (sorta timestamp) it closes/terminates to a file. It works fine when the app is terminated by myself but doesn't when when I shutdown/reboot Windows. The code that saves the timestamp to a file resides in FormClosing event. But for some reason it doesn't fire or the code to save the file doesn't get executed when I shut down/reboot windows.

Is there a way, probably thru' Win API to register my app with Windows, so that windows actually waits for my app to terminate in a sane way after saving the data. I remember of reading about this possibility somewhere, I don't remember now.

View 4 Replies

IDE :: Application Stopped Working After Shutdown Event

Feb 16, 2012

Visual Studio 2008, VB.NET, .NET Framework 3.5. Development Machine Vista Business. Problem occurs in Vista, Windows 7. It does not occur on XP. Others involved: Bennet-Tec Tlist tree control, Farpoint Spread for Winforms 5 spreadsheet control, ADO.NET with Access Database. Message issued:

[Code]...

View 4 Replies

Application Firing Shutdown Event On Form Close?

Sep 10, 2010

I have a login form that when the user clicks OK and logs in successfully it loads the main application form.However when I show the main form and close the login form, the app is firing the shutdown event.Is this because the app thinks that the login form is the only form open and thus fires the shutdown event?Here is the code for the login routine, when I call Me.Close() at the end is when the shutdown event is fired. Am I doing things out of order? I used to do it this way in VB6 with no problems (I know they're a lot different).Note, it's nothing in frmMain either, this happens no matter what form I try to open.

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
'iLoginResult = 0 : Success
' 1 : Invalid user name or password
' 2 : Other login error

[code]....

View 3 Replies

Deployable Shutdown - Application Failed To Initialize Properly

May 18, 2010

I'm trying to create an app with a GUI to run at a specified time (handled by Altiris) to run a locally stored program to give the user a specified amount of time to close the task, otherwise the computer is forced to log off destroying any unsaved information. The code I have looks to work, when built it shows no errors, but when I pull the executable (using VS 2010 Express) after the time expires I get a Windows Application Error for the program stating:
The Application failed to initialize properly (0xc0000142).

The code I'm running is:
Imports System
Imports System.Timers
Public Class Form1
Private Shared Shutdowntimer As System.Timers.Timer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
[Code] .....

View 6 Replies

Forms :: Detecting If Form Is Active

Jun 2, 2011

I am new to vb.net and what I want to do is change the bg color if my form is active.
I have tried searches and try and fail but I cant figure it out

View 9 Replies

Detecting Multiple Monitors & Centering Different Forms?

Oct 25, 2009

Basically, I have a program that uses up one Monitor (With maximize/minimize/etc options), and I'm going to develop another window that by default, you'll have to swap to. But, if there are two or more monitors detected, throw the 2nd form on the 2nd monitor.

I have found a way to detect multiple monitors (Using the SystemInformation Class to return the monitor count), but it's placing the form on the other monitor that's the problem.

View 2 Replies

Forms :: Detecting A Textbox Scrollbar Position?

Nov 2, 2009

I need to set a variable upon the user scrolling to the end of the text on the textbox ("Scroll to end to accept terms") type thing but I can't seem to find how to get the value.

View 2 Replies

Forms :: Detecting CheckBox CheckedChanged Event

Oct 27, 2009

I would like MyProcess() to fire when I click on any of several checkboxes. I could do it like this. [code]I have alot of checkboxes, and anyway, this method isn't very scalable.Is there any other way for a form (or panel maybe) to detect mouse events on child controls kind of like the way the KeyPreview property of a form allows it to detect key events of it's child controls?

View 3 Replies

Forms :: Detecting Open MDI Childs When MDI Parent Is Closed

Dec 16, 2010

I'm new to VB 2010 but have be using VB6 for many years.I'm currently stuck trying to store the state of open MDI childs at the moment the MDI parent is closed. Clicking the parent upper right close button appears to close all open MDI childs before running the parent 'Closing' or 'Disposed' events.I am therefore unable to detect which MDI childs are open and cannot restore them next time the application is run.Is there any other event for the MDI parent I can detect the start of the closing process before the children are closed?

View 2 Replies

Detecting A Message Box Opened In Another Application?

Jun 2, 2010

I am developing a windows service, in vb .et, that launches a legacy application that performs some work. The service acts as a wrapper around the legacy app allowing users to automate an otherwise manual operation.Everything is working great, except occasionally the legacy app displays a messagebox. When it does this the process halts until the message box is closed.

As the service will be running on a server there will be no user to close the message box.The service launches the legacy application in a System.Diagnostics.Process.My question is, is there way to detect that a message box has been displayed by a process that I have started using System.Diagnostics.Process and is there a way to through code to close the messagebox.

View 2 Replies

.net - Detecting If Snipping Tool Is Open Within A Web Application?

Aug 24, 2010

I was just wondering - is it possible to detect, with either .net, SilverLight, Flash or some other plugin, whether or not Snipping Tool is open, or detect when the user opens it (after the page has loaded)? Also is it possible to detect when print screen is pressed even if another window is active?

View 1 Replies

IDE :: Excluding Forms To Convert A Window Forms Application To Class Library Application

Jan 16, 2012

I am not able to find the Exclude Command in VB 2010 Express. I have no idea which version of Visual Studio it is working with. I've got one 217MB VB 2010 Express file and many 2008 VB Express files with one of them measuring 31 MB. There many other SQL files and .Net Files.

View 4 Replies

Basic Application(windows Forms) Doesn't Exit Properly After Navigating Through Forms

Jul 9, 2010

I have a basic three form application. It doesn't seem to close after navigating through forms. If I were to open the application, and the main form is displayed. If I press the X button, the application closes fine(Goes from processes) If I were to open the application, and then navigate from the main form to another form using me.hide & form1.show, and press the red X on Form1, the application again, closes fine.

[Code]...

View 6 Replies

Application That Has Multiple Front Ends Developed Using Windows Forms / WPF / ASP / Compact Framework Mobile Forms

Apr 9, 2010

I have the requirement to create an application that has multiple front ends developed using Windows Forms, WPF, ASP and Compact Framework Mobile Forms.I would like to be able to create a series of obejct representing the business logic and have this logic accessible from the various front ends available. My first thought was to use remoting as I'd like to be able to pass the business objects back and forth between client and server but the compact framework doesn't support remoting and also transferring a full framework business object to a compact framework business object doesn't seem possible.My next thought was to use web services but again the passing of business objects seems to be very hard to accomplish. Without doing this I would have to create individual web methods for each business operation.

Finally my next option is to use sockets and write the whole client/server logic within some classes and expose them to the UI/Business layer. My only problem with this is it is not scaleable should the number of clients increase dramatically whereas using remoting or web services I can host the solution via ASP.Net.Does anybody have an ideas on the best way forward for this or even have any input on how they would write an application that required a windows form, wpf, asp website and mobile device GUI all of which want to use the same business logic?

View 3 Replies

Application Does Not Return From Call To System.Windows.Forms.Application.DoEvents?

Aug 2, 2011

I have a windows forms application written in VB.NET which scrapes information from serveral web pages (who doesn't right)? Anyway, I am having problem with one particular site where partway through the page navigation my application hangs. When I press pause (or break) in the debugger, it stops on a call to System.Windows.Forms.Application.DoEvents.

Resuming execution shows that it really is stuck on this line (it does not reach the next line of code). It also hangs about the same point each time I run it (at least its consistent). Since System.Windows.Forms.Application.DoEvents yields to other threads on the same processor and then resumes execution of the current thread, I think the problem is that some other thread is not behaving well (not returning from some event handling code). I thought Windows 7 was pre-emptive, which makes me
doubt that theory but I really don't know.

[Code]...

The program scrapes somewhere between 12 and 14 pages before it gets stuck on the call to DoEvents. Does anyone have a clue why this would happen? Why would any call to DoEvents hang?

View 1 Replies

Re-direct Output From A Console Application To A Textbox In A Windows Forms Application?

Sep 14, 2010

I am trying to use the System.Diagnostics.Process class.I have the following Windows Forms application. It consists of 1 Button and 1 TextBox. The only code is for the button click event as follows.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myProcess As New Process()

[code]....

View 2 Replies

Convert A VB2008 Console Application To Windows Forms Application

Feb 7, 2010

I have a fully functional multi-threaded VB2008 console application that I need to convert to a windows forms application. I am doing this to add additional functionality at a later time. How would I go about doing this?

View 9 Replies

Forms :: Transfer Console Application To Window Form Application

Dec 22, 2011

modify console application below to window form application for me.I've tried by myself for million times, but i couldn't console application.rar?

View 2 Replies

Converting MS ACCESS Application To Windows Forms Application

Jun 23, 2010

My boss gave me an MS Access application that was developed by our former colleague. He wants me to convert that application to VB.Net Windows form application. I went through the MS Access Application. It contains tables, queries, forms, reports and macros. I could not find the programming (Where is the code written in MS Access?). My boss wants the windows application to be same as the MS Access Application (both in design and logic). I don't how will i develop the windows form. How can I achieve this?

View 2 Replies

Converting MS ACCESS Application To Windows Forms Application?

Jun 23, 2010

My boss gave me an MS Access application that was developed by our former colleague. He wants me to convert that application to VB.Net Windows form application. I went through the MS Access Application. It contains tables, queries, forms, reports and macros. I could not find the programming (Where is the code written in MS Access?). My boss wants the windows application to be same as the MS Access Application (both in design and logic). I don't how will i develop the windows form.

View 4 Replies

Forms :: Two Forms Application Is Closing

Dec 12, 2011

I have two forms and a button on the first form. What i want is when i click the button the second form to show and the first one to close. But this isn't working with: Form2.show() Me.close All the application is closing with the code above.

View 4 Replies

How To Block Shutdown

Aug 1, 2009

How to block shutdown using vb.net?

View 1 Replies

How To Shutdown A Locked PC

Sep 13, 2010

Shutting down a pc in vb.net is easy:Process.Start("shutdown", "-s -t 00")less the user has locked the pc in which case the above fails.How do I get around this in vb.net? How do I shutdown a locked PC?

View 5 Replies

ShutDown And Restart

Jun 11, 2010

I am making a program that takes a time input from the user or a countdown amount and when that time comes it will shutdown or restart or log off the computer. I know how to make the timing code and everything else but i don't know how to shutdown or restart or log off.

View 1 Replies

Shutdown Locked PC?

Jun 11, 2011

I'm currently writing a small system tray app that needs to shutdown my PC at a certain time. That bit's easy:Process.Start("shutdown", "-s -t 00")But how do I do this when my PC is locked? The above doesn't work and I don't want to leave my PC unlocked and unattended

View 1 Replies

Call Shutdown.exe By Using GetProccessByID?

Apr 30, 2007

Can I call shutdown.exe by using GetProccessByID? If so, what is the code(In VB 2005)?

View 3 Replies

Computer Shutdown By Button?

Feb 23, 2011

I've written a program which I propose to give a local club, which sadly may be'attractive' to pirates so I propose to build in some sort of anti-copying feature.My idea is to hide a file in a folder somewhere in the club's laptop, then on program start up I'll check to see if that file exists and if it's not there, which it's unlikely to be on a pirates machine, I'll flag up a message box saying that if they have a legitimate reason to install the program on a different machine they'll have to contact myself.By way of nuisance value, pressing the 'OK' button on the message box will cause the machine running, what I'm assuming is a pirated copy, to shut down.I've been looking at the VB.NET forum and MSDN for ideas as to how to achieve this and the general opinion seems to be:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("shutdown", "-s")

[code].....

View 23 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved