473,386 Members | 1,779 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,386 software developers and data experts.

Exiting an Application on start-up

Hi,

I have created an application with two forms, the main form and a
login form that allows the user to supply a username and password.

In my main form initialisation i have the following:

Sub InitializeForm()
'Open the login box
Dim LoginBox As New FrmLogin
If LoginBox.ShowDialog(Me) = DialogResult.OK Then
mydb = New ClassTimeDB("E:\Databases\Time",_
LoginBox.TxtUserID.Text, LoginBox.TxtPassword.Text)
LoginBox.Dispose()
LoginComplete()
Else
Application.Exit()
End If
End Sub

I have set the OK and Cancel buttons on the login form to return the
OK and Cancel commands in the DialogResult property of the buttons

The OK works fine however, the cancel does not close the application.

Further investigation showed that the Application.AllowQuit property
is set false - so this is obviously why my app won't quit. I guess
this is because the application hasn't fully initialised yet?

How can i accomplish what i want to do?

Thanks in advanced
--
Dave

Nov 21 '05 #1
3 985
Dave,

I use for this "me.close"

I hope this helps,

Cor
Nov 21 '05 #2
Nope, that causes an exception, giving the reason

Cannot access a disposed object named "FrmMain"

On Thu, 8 Sep 2005 11:47:40 +0200, "Cor Ligthert [MVP]"
<no************@planet.nl> wrote:
Dave,

I use for this "me.close"

I hope this helps,

Cor


Nov 21 '05 #3
Dave,
Nope, that causes an exception, giving the reason

Cannot access a disposed object named "FrmMain"

LoginBox.Dispose()
LoginComplete()
Else
me.close
End If
End Sub

Strange

Cor
Nov 21 '05 #4

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

Similar topics

7
by: David Elliott | last post by:
I have created an application that will dynamically load other DLLs (plugins). The new plugin is a winform with an embedded IE Browser. I am wanting to have the form to run in its own thread....
8
by: Andrew Warren | last post by:
I'm trying to exit a Windows Forms application while in the form's constructor (after InitializeComponent() has been called) and am finding that calling Application.Exit () still leaves the form...
2
by: pnp | last post by:
Hi all, I'm working on a win app that uses a logon form to verify the user that logs in the program and then hides the first form and displays an MDI form where the user does his work. The app is...
6
by: GL | last post by:
I am getting a crash while exiting from my application. Pl find the Stack Trace of the crash: System.Windows.Forms.Application.ThreadWindows.ThreadWindows(System.Windows.Forms.Control parent =...
2
by: tt | last post by:
Hi, ANy ideas on this? When I click the close button of a window in VB.net which method gets called? I used Applicaton.exit in some method of my appln. to exit the application but, it still...
3
by: John Wildes | last post by:
Hello All I have an application that has one form. I start the application using a Application.Run(New frmMain) command in Sub Main(). When I exit, the exit menu Item simply does a Me.Close ....
1
by: kuhrty | last post by:
Hi, I am creating a multi-winform project. Everything has been working fine, except after I perform an update to the database and decide to Exit the winform after the update operation is...
6
by: Ant | last post by:
Hi all, I'm putting together a simple help module for my applications, using html files stored in the application directory somewhere. Basically it sets up a basic web server, and then uses the...
2
by: jrpfinch | last post by:
Is the following the most elegant way to exit a multi-threaded application on a Ctrl-C? I am a complete beginner and would have thought there was some way of doing it without having to use while...
5
by: care02 | last post by:
Hi! I have the following problem: I have written a short Python server that creates an indefinite simulation thread that I want to kill when quitting (Ctrl-C) from Python. Googling around has...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.