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

C# equivalent for VB6 "End"?

Does anyone know what the C# equivalent for VB6 End is?

I'm starting up a form with a boolean test. If I fail, I just want to
end the app. Even though I close the form, it picks up on the line
after the bracket and continues loading the form.

Here's my snippet:

DalMan._drCurrentUser = DalMan._dtUsers.FindByUserName("Init");
if (DalMan._drCurrentUser == null)
{
MessageBox.Show("Unable to initialize. Please contact your
administrator.","Initialization
Error",System.Windows.Forms.MessageBoxButtons.OK,S ystem.Windows.Forms.MessageBoxIcon.Stop);
SplashScreen.CloseForm();
this.Close();
this.Dispose();

}
Nov 16 '05 #1
3 18238
Hi Summit,

If you put the check in Main() you can just return; before doing Application.Run

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Summit,

As it should. What I would do is make a call to the static Exit method
on the Application class, and then return from the method immediately. You
have to unwind the stack up to the point where the message handler processed
the message using this method, so if you return from a method, you have to
make sure that all methods return without executing any more code as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Summit" <su*******@hotmail.com> wrote in message
news:6d**************************@posting.google.c om...
Does anyone know what the C# equivalent for VB6 End is?

I'm starting up a form with a boolean test. If I fail, I just want to
end the app. Even though I close the form, it picks up on the line
after the bracket and continues loading the form.

Here's my snippet:

DalMan._drCurrentUser = DalMan._dtUsers.FindByUserName("Init");
if (DalMan._drCurrentUser == null)
{
MessageBox.Show("Unable to initialize. Please contact your
administrator.","Initialization
Error",System.Windows.Forms.MessageBoxButtons.OK,S ystem.Windows.Forms.Messag
eBoxIcon.Stop); SplashScreen.CloseForm();
this.Close();
this.Dispose();

}

Nov 16 '05 #3
Hi Summit,

If you put the check in Main() you can just return; before doing Application.Run

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #4

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

Similar topics

3
by: ncf | last post by:
I'm having an odd problem. I'm getting an error from IDLE saying "End Of Line detected while scanning single-quoted string." Odd thing is, it's not single-quoted, it's one of the doc-strings (if...
2
by: JohnR | last post by:
Wow, this is unbelieveable. I've narrowed it down to a few lines of code. Create a new project in VB.NET and put 2 buttons on it (a FBD button and an EXIT button) and enter these lines for the...
13
by: Simon Wigzell | last post by:
Can I trap when the scroll is ended? This is what I want - the calculator disapears when the site visitor starts scrolling the main page. I'm doing that with an "onScroll()" function. I'm bringing...
1
by: Najm Hashmi | last post by:
Hi all , I am trying to create a store procedure and I get the following error: SQL0104N An unexpected token "END-OF-STATEMENT" was found following "END". Expected tokens may include: "JOIN...
4
by: Alex Maghen | last post by:
Does a call to Response.Redirect result in an immediate exit from the current page function (i.e. a "return()")? I want to make sure that the statements after the Response.Redirect() do not get...
3
by: caston | last post by:
Well, everybody can now agree with the fact that the Ajax hype is over. Still multiple Ajax Frameworks are flourishing, aren't they? So, last night I questioned myself with the following: "When...
28
by: kaleolani65 | last post by:
I have been having an ongoing problem with a DB at work concerning people getting "locked out". Access warnings relating to "exclusive" mode The research I have done and the replies received...
5
by: BA | last post by:
Hi there I am trying to write an "application" in Access 2000, that displays a front end and allows the user to interact with the database without seeing Access loaded, in the background, nor on...
2
by: jahanas | last post by:
Private Sub txtBox1.txtLife_Enter(ByVal frmQuote) Handles txtLife Me.txtQuote.Text = "I like life, it's something to do." End Sub Private Sub txtBox2.txtFuture_Enter(ByVal...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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.