By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,138 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

Disposing the calling form

P: n/a
HI,

my project's start object is a login form.
When login is successful, it opens a new form, with:

Dim CalledForm As New MyForm
CalledForm.Owner = Me
CalledForm.Show()

Now I want login form to disappear once CalledForm has opened.
Setting enabled / visible to true, form is still in memory and the
application does not close.
With Me.Dispose() into login form code, CalledForm closes too (not only
login form).

What is the right way?
Thanks

N! Xau

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
CT
I would open both forms from the Sub Main procedure, which you can set to be
the startup object. Then, check the feedback from the Login form, before
deciding to the CalledForm.

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105
Communities - http://community.integratedsolutions.dk

"N! Xau" <nx**@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
HI,

my project's start object is a login form.
When login is successful, it opens a new form, with:

Dim CalledForm As New MyForm
CalledForm.Owner = Me
CalledForm.Show()

Now I want login form to disappear once CalledForm has opened.
Setting enabled / visible to true, form is still in memory and the
application does not close.
With Me.Dispose() into login form code, CalledForm closes too (not only
login form).

What is the right way?
Thanks

N! Xau

Nov 21 '05 #2

P: n/a
or instead of doign calledform.show, call calledform.showdialog

the rest of the application will not continue executing until the user
has clicked on ok and the login form disposed of. You then have the
instance of the calledform in order to check any values the user has
added as input:

Dim CalledForm As New MyForm
CalledForm.Owner = Me
if CalledForm.ShowDialog() = dialogresult.OK
'Do your error checking for the correct password
end if

CalledForm.btnOK Pressed:
dialogresult = dialogresult.ok
me.close

CalledForm.btnCancel Pressed:
dialogresult = dialogresult.cancel
me.close

Nov 21 '05 #3

P: n/a
N

Don't make your login form your mainform.

There is not 'one' right way. I find this the nicest.

In a normal mainform you can set in the load event to show your login form.

A lot of people are writing that in the load event the form is not yet
showed, that is very nice because now you can do in that. (In a very
rudimentair way there is needed some more)

\\\
dim frmLogin = new formLoging
if frmLogin.show <> message.Ok then
then me.close
else
frmLogin.dispose
'normally a dispose is not needed however a showdialog is one of the
exceptions
end if

And your program stops if the login form not returns dialog.ok.

I hope this helps,

Cor
"N! Xau" <nx**@hotmail.com> schreef in bericht
news:11**********************@g43g2000cwa.googlegr oups.com...
HI,

my project's start object is a login form.
When login is successful, it opens a new form, with:

Dim CalledForm As New MyForm
CalledForm.Owner = Me
CalledForm.Show()

Now I want login form to disappear once CalledForm has opened.
Setting enabled / visible to true, form is still in memory and the
application does not close.
With Me.Dispose() into login form code, CalledForm closes too (not only
login form).

What is the right way?
Thanks

N! Xau

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.