Hi,
I've a form.load event that initializes a cardreader, which is crucial to
the operating of the program.
Now if that throws an exception, the program needs to give a message and
close down.
I tried using Application.Exi t(), but that happily executes the rest of the
code (initializing a browser component and adding some images to buttons).
Does anyone have any idea on how to make the program *really* shutdown
without running anything more ? Except maybe form.closing, that could come
in handy too :) 2 1338
Hi,
Initialize your cardreader in a sub main(in module). If cardreader
doesnt throw an exception show the Form. Of course make sub main your
startup object.
Public sub Main
Try
'Initialize CardReader Here
Dim frm as new Form1
Application.Run (frm)
Catch ex as exception
Messagebox.Show ("An Error has Occurred")
end try
end sub
Ken
----------------------------
"Silby" <Si***@nothanks .net> wrote in message
news:ek******** ************@ph obos.telenet-ops.be... Hi,
I've a form.load event that initializes a cardreader, which is crucial to the operating of the program. Now if that throws an exception, the program needs to give a message and close down. I tried using Application.Exi t(), but that happily executes the rest of
the code (initializing a browser component and adding some images to buttons). Does anyone have any idea on how to make the program *really* shutdown without running anything more ? Except maybe form.closing, that could come in handy too :)
Ahh, excellent.
Thanks for the tip !
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ew******** ******@TK2MSFTN GP10.phx.gbl... Hi,
Initialize your cardreader in a sub main(in module). If
cardreader doesnt throw an exception show the Form. Of course make sub main your startup object.
Public sub Main
Try 'Initialize CardReader Here Dim frm as new Form1
Application.Run (frm) Catch ex as exception Messagebox.Show ("An Error has Occurred") end try end sub
Ken ---------------------------- "Silby" <Si***@nothanks .net> wrote in message news:ek******** ************@ph obos.telenet-ops.be... Hi,
I've a form.load event that initializes a cardreader, which is crucial
to the operating of the program. Now if that throws an exception, the program needs to give a message and close down. I tried using Application.Exi t(), but that happily executes the rest of the code (initializing a browser component and adding some images to
buttons). Does anyone have any idea on how to make the program *really* shutdown without running anything more ? Except maybe form.closing, that could
come in handy too :)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alexey Kouzmitch |
last post by:
Hi,
I wrote a console application which is called from a SQL Server job. The
application utilizes a COM object, to pump data from a legacy (not very old
however) application to SQL server. The application works fine, but once in
a while it fails with the following message written to the event log:
-----------------------------------------------------------------------
The description for Event ID ( 0 ) in Source ( .NET
Runtime )...
|
by: ds |
last post by:
fatal error C1189: #error : WINDOWS.H already included. MFC apps must
not #include <windows.h>
I have an existing C-based application. I need to add encoder card
support to this application. Encoder card Skd is vc++ based. Hence I
ported the c-code into VC++. I wrote a class for encoder card (.cpp)
and included <afxwin.h>. The class itself compiles fine though when I
make a reference of this c++ class in the main (c-code), I get the...
|
by: Ron L |
last post by:
I have an MDI application with a number of child windows. In each child
window I am catching the Closing event and having the child window decide if
it should set cancel to true. The intent here is to ensure that no child
window can close while it is in a state where user entered information can
be lost. I have just noticed that while the Closing event is caught if I
click the X on the child window, it is not caught if I click the X on...
|
by: Jason MacKenzie |
last post by:
I have a production critical windows forms application. I have try catch
blocks everywhere to handle every eventuality. However occasionally, every
couple of months, the application crashes. Its usually a .Net Framework
error message telling me there was an unhandled exception
An example would be last October when the clocks rolled back. My question
is: is there a way to handle an exceptions that might make it through the
error...
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
| |
by: Dursun |
last post by:
I need to make sure that the user cannot close (using "X") the form before
saving the data on it. Which form event should I write the control code in?
Thank you,
-Delen
|
by: John Kraft |
last post by:
Hello all,
I'm experiencing some, imo, strange behavior with the StreamReader
object I am using in the code below. Summary is that I am downloading
a file from a website and saving it to disk for further parsing. I
know, I could use the WebClient and it would be easier, but I don't
have the flexibility I want with it.
This code appears to work exactly the way I want unless the user
cancels the the background operation. In that...
|
by: dave m |
last post by:
I'm creating a class library (dll) and am confused as how to pass any
information, should any exceptions occur, back to the calling application.
Such as:
Try
x = 3 / 0 ' divide by 0 error
Catch ex as Exception
'(how do I pass ex info back to calling app?)
End Try
|
by: =?Utf-8?B?UHVjY2E=?= |
last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3
forms. I want allow users to move forward and backward with the forms and
retain the data users have entered. I thought I'll make the inactive forms
invisible but this is creating a memory corruption problem when user close
the form2 or form3 and not the formMain.
My main form has a Next button which makes the main form invisible and
starts a new form which I'll...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |