473,387 Members | 1,535 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.

How To: Close application during Start Up (VB.net)

VB.net 2003 (standard)

In my application, within FORM1_LOAD, I check for various things (ie valide
user names, files, etc.). What I want to do is upon an event such as "No
Valide User Name Found" to pop up a warning message about the event and then
close the application.

I can do everything I want with the exception of a clean shut down during the
Form1_Load.

Back in VB6, I did this by:

Unload Me
Exit Sub

How do I do this in VB.net? I tried "Unload.Me" but it returns an error as
the application continues to try to run.

I'm sure it's a simple thing... but I've not found any reference to this in
all my books.

Regards,

Bruce
Jul 21 '05 #1
6 2597
Form.Close() ?

Sunny
In article <oo********************************@4ax.com>,
Us**@NoWhere.com says...
VB.net 2003 (standard)

In my application, within FORM1_LOAD, I check for various things (ie valide
user names, files, etc.). What I want to do is upon an event such as "No
Valide User Name Found" to pop up a warning message about the event and then
close the application.

I can do everything I want with the exception of a clean shut down during the
Form1_Load.

Back in VB6, I did this by:

Unload Me
Exit Sub

How do I do this in VB.net? I tried "Unload.Me" but it returns an error as
the application continues to try to run.

I'm sure it's a simple thing... but I've not found any reference to this in
all my books.

Regards,

Bruce

Jul 21 '05 #2
* Mr. B <Us**@NoWhere.com> scripsit:
In my application, within FORM1_LOAD, I check for various things (ie valide
user names, files, etc.). What I want to do is upon an event such as "No
Valide User Name Found" to pop up a warning message about the event and then
close the application.


\\\
Public Module Program
Public Sub Main()
If ... Then
Application.Run(New MainForm())
End If
End Sub
End Module
///

In the project properties, select 'Sub Main' as startup object.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Jul 21 '05 #3
I'd use Herfried's method. But if you absolutely have to load the form
first to check your validations, then you can use Me.Close() and/or
Application.Exit() to abandon loading.
______________________________
The Grim Reaper

"Mr. B" <Us**@NoWhere.com> wrote in message
news:oo********************************@4ax.com...
VB.net 2003 (standard)

In my application, within FORM1_LOAD, I check for various things (ie valide user names, files, etc.). What I want to do is upon an event such as "No
Valide User Name Found" to pop up a warning message about the event and then close the application.

I can do everything I want with the exception of a clean shut down during the Form1_Load.

Back in VB6, I did this by:

Unload Me
Exit Sub

How do I do this in VB.net? I tried "Unload.Me" but it returns an error as the application continues to try to run.

I'm sure it's a simple thing... but I've not found any reference to this in all my books.

Regards,

Bruce

Jul 21 '05 #4
With Deft Fingers, hi***************@gmx.at (Herfried K. Wagner [MVP]) wrote:

\\\
Public Module Program
Public Sub Main()
If ... Then
Application.Run(New MainForm())
End If
End Sub
End Module
///

In the project properties, select 'Sub Main' as startup object.


Much appreciated!

Bruce
Jul 21 '05 #5
With Deft Fingers, Sunny <su******@icebergwireless.com> wrote:
Form.Close() ?

Sunny


??? (duh on my end)... Thanks!

Bruce
Jul 21 '05 #6
With Deft Fingers, "The Grim Reaper" <gr*********@btopenworld.com> wrote:
I'd use Herfried's method. But if you absolutely have to load the form
first to check your validations, then you can use Me.Close() and/or
Application.Exit() to abandon loading.


Good point! Thank you!

Bruce
Jul 21 '05 #7

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

Similar topics

2
by: Christophe Halatek | last post by:
Hi NG, sometimes I bekome a "Server Application Error" on my w2k Server when call a ASP page The server has reached the maximum recovery limit for the application during the processing of...
3
by: Karuppasamy | last post by:
Hi I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net . I installed everything as per the Instructions given in the 'Development Using the Logging Block'. ...
3
by: carmen | last post by:
I need to launch application-2 from application-1 and close application-1. My code is CreateProcess ("app2",0,0,0,0,0,0,0,0,0); Application.Exit(); but application-1 is not terminate since I...
0
by: Chetna Joshi | last post by:
We have created a Web Application in ASP.NET using VB.NET. We have also created a Web Setup Project for installing the Web application on the target machine. I need help on creating a shortcut to...
1
by: Nusret Bajric | last post by:
Hello, I have a problem with starting a COM application from my ASP.NET application on the server machine. I get an error with a message permission denied during creation of COM object. If I...
0
by: jack | last post by:
I am getting this error on my web server runnint ASP.NET on Windows 2003, it kills the serving web pages. The only way to get the web pages to start serving is to restart the server. I can't find...
6
by: Mr. B | last post by:
VB.net 2003 (standard) In my application, within FORM1_LOAD, I check for various things (ie valide user names, files, etc.). What I want to do is upon an event such as "No Valide User Name...
7
by: Russ Green | last post by:
I am currently developing an application in VB.NET that uses the Microstation's object model via COM Interop. I have a problem regarding multiple instances of the Microstation application...
4
by: Simon Verona | last post by:
I'm looking to build a "kiosk" style of application in vb.net (using winforms)... Writing the application itself is no problem. What I want to do though is have the PC set so that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.