473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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._drCurre ntUser = DalMan._dtUsers .FindByUserName ("Init");
if (DalMan._drCurr entUser == null)
{
MessageBox.Show ("Unable to initialize. Please contact your
administrator." ,"Initializatio n
Error",System.W indows.Forms.Me ssageBoxButtons .OK,System.Wind ows.Forms.Messa geBoxIcon.Stop) ;
SplashScreen.Cl oseForm();
this.Close();
this.Dispose();

}
Nov 16 '05 #1
3 18251
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.co m

"Summit" <su*******@hotm ail.com> wrote in message
news:6d******** *************** ***@posting.goo gle.com...
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._drCurre ntUser = DalMan._dtUsers .FindByUserName ("Init");
if (DalMan._drCurr entUser == null)
{
MessageBox.Show ("Unable to initialize. Please contact your
administrator." ,"Initializatio n
Error",System.W indows.Forms.Me ssageBoxButtons .OK,System.Wind ows.Forms.Messa g
eBoxIcon.Stop); SplashScreen.Cl oseForm();
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
1961
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 that's what you call them). In the following code (class name replaced with <<<NAME>>>), the error is being highlighted as the hyphen joining "non"...
2
1559
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 click events: Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub Private Sub...
13
16526
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 the calculator back with a "onMouseup()" which I thoguht would activate when the scroll bar was released but it doesn't. What I really want is an...
1
30188
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 <joined_table> Explanation: A syntax error in the SQL statement was detected at the specified token following the text "<text>". The "<text>"...
4
2365
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 called. Alex
3
1763
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 Ajax Frameworks will be gone? What is required to get rid of them and start using browsers?" (To be more precise, I should probably also mention what...
28
10233
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 suggest I split the DB (front-end/back-end). A working copy of the DB was split and I can see how the DB (back-end) is being updated. Being...
5
3202
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 the taskbar. When I click on the generate report button, from the front-end's form, no report/query is displayed. However, if i disable the code...
2
6478
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 frmQuote) Handles txtFuture Me.txtQuote.Text = "The future isn't what it used to be." End Sub Private Sub txtBox3.txtTruth_Enter(ByVal...
0
7609
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...
0
8118
jinu1996
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...
1
7666
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...
1
5504
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...
0
5217
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...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
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
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
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...

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.