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

Disposing the calling form

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
3 985
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Chris Capel | last post by:
I've heard a lot of talk on the forum about memory managment in .NET and disposing things, finalizing them, garbage collection, etc. My question is which managed types need to be disposed after...
9
by: AP | last post by:
If I display a form using the ShowDialog method, when the form is closed should I have to explicitly call dispose on the form in order to ensure it releases its resources, or should this be handled...
5
by: Mathias L. | last post by:
I have two questions for which I couldnt find answer: If I programaticaly close DialogForm (calling Close()), is it enough or do I have to dispose it as MS.NET help says? Also, in overriden...
13
by: MuZZy | last post by:
Hi, Just wanted to make sure i get it right: consider this class: // =========== START CODE ============= class Test { private SqlConnection con = null; public void Connect() { con = new...
5
by: Chris | last post by:
I have a form that requires drawing custom lines on it. The color of the lines is suppose to be the same as the forcolor of the form. Am I doing this the most efficent and correct way? ...
13
by: Adam Right | last post by:
Hi, I am developing a financial application and you know that there are huge amount of data in these similar aplications. I have a MDIChild form and the other forms are opened in this form. For...
3
by: Henry Jones | last post by:
I have a project that has 5 or 6 forms. VB.NET VS 2005 In the FormClosing Event of each form I have the following code: If Not IsNothing(frmA) Or Not frmA.IsDisposed Then frmA.Close() If...
4
by: Rob | last post by:
Hi all, I wrote myself a little function to do my own housekeeping, I can call it by using Dispose(object) Within this function there's a select case statement which will then, based on...
29
by: Jerry Spence1 | last post by:
I'm rather confused as to whether something should be disposed of, or not. What is the general rule? How can you be sure of doing the right thing? I've heard about disposing unmanaged resources but...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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...
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?

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.