Open Another form and close itself

  • Thread starter Thread starter Saber
  • Start date Start date
S

Saber

I did a web search and found someone is looking for what I'm looking for:

There are 2 forms...named => formA and formB
and each of them have their own button named => btnA and btnB

The application starts with formA

can you show me the code that... when I click on btnA in formA, It will
CLOSE formA and open formB...

Then when I click btnB from formB, it will close formB and open back formA

How can I do this? I dun want their visible set to .false
I want them really close and use no resources from my computer.. How?
Thanks for your help....

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21185658.html
 
Thanks, But I couldn't find a solution in that article.
it is about communication between froms, I don't know how to
close a form through another form. (or show a new form, then close old form)
 
If formb is instantiated within forma, then you cannot close forma without
destroying formb.

What you can do is to use the code in the button in forms a and b to return
a dialog result to the calling code so we could have a loop in the sub Start
which is an optional startup point and use the return value from the from to
decide what action to take next.
 
Thanks Herfireid,
Sorry for this stupid question, but how can I use your code?
I created 2 classes and 1 module and pasted your code.
but what then...
 
i'm sorry but my solutions could do that

you can access to formA in formB with

formA.close
 
sorry

1.can you show me the code that... when I click on btnA in formA, It
will
CLOSE formA and open formB...
and BECAUSE you have the class (of msnd sample)
you could run an procedure in formB

'Create form B
Dim frm as new formB
frm.show()
'Call a procedure in formB to close FormA (with the class msdn)
classForm.formB.CloseFormA

Don't forget that your have in
formB_Load
classForm.formB = me

and in formB_Closed
classForm.formB = nothing
 
You dont seem to be reading or understanding what people are saying to you
here. In .NET Everything is an object.

This means you need to instantiate them somwhere, and where would this be,
'An object' A form is an class which has been instantiated so if we have
two objects and each instantiates the other within itself, then one cannot
destroy the other without destroying itself.

You have been given several approaches to resolving this conundrum, what
specifically do you want from the folks here over and above what has already
been given. ?


--
Best Regards

The Inimitable Mr Newbie º¿º



Saber said:
Thanks Herfireid,
Sorry for this stupid question, but how can I use your code?
I created 2 classes and 1 module and pasted your code.
but what then...
 
Thanks for your guides Mr Newbie,
Herfried gave me a code and I asked him how to use it.
I read your previous post and satisfied, but I've to find
an alternative.

There are 12 forms in my program, on each of them there
are 11 links to other forms.
what's your solution to show just one form while the program is running?

Mr Newbie said:
You dont seem to be reading or understanding what people are saying to you
here. In .NET Everything is an object.

This means you need to instantiate them somwhere, and where would this be,
'An object' A form is an class which has been instantiated so if we have
two objects and each instantiates the other within itself, then one cannot
destroy the other without destroying itself.

You have been given several approaches to resolving this conundrum, what
specifically do you want from the folks here over and above what has
already been given. ?


--
Best Regards

The Inimitable Mr Newbie º¿º



Saber said:
Thanks Herfireid,
Sorry for this stupid question, but how can I use your code?
I created 2 classes and 1 module and pasted your code.
but what then...

Herfried K. Wagner said:
"Saber" <saber[.AT.]oxin.ir> schrieb:
There are 2 forms...named => formA and formB
and each of them have their own button named => btnA and btnB

The application starts with formA

can you show me the code that... when I click on btnA in formA, It will
CLOSE formA and open formB...

Then when I click btnB from formB, it will close formB and open back
formA

See:

<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/1f74a1bd0a1f457b>
 
read my previous post.


--
Best Regards

The Inimitable Mr Newbie º¿º


Saber said:
Thanks for your guides Mr Newbie,
Herfried gave me a code and I asked him how to use it.
I read your previous post and satisfied, but I've to find
an alternative.

There are 12 forms in my program, on each of them there
are 11 links to other forms.
what's your solution to show just one form while the program is running?

Mr Newbie said:
You dont seem to be reading or understanding what people are saying to
you here. In .NET Everything is an object.

This means you need to instantiate them somwhere, and where would this
be, 'An object' A form is an class which has been instantiated so if we
have two objects and each instantiates the other within itself, then one
cannot destroy the other without destroying itself.

You have been given several approaches to resolving this conundrum, what
specifically do you want from the folks here over and above what has
already been given. ?


--
Best Regards

The Inimitable Mr Newbie º¿º



Saber said:
Thanks Herfireid,
Sorry for this stupid question, but how can I use your code?
I created 2 classes and 1 module and pasted your code.
but what then...

"Saber" <saber[.AT.]oxin.ir> schrieb:
There are 2 forms...named => formA and formB
and each of them have their own button named => btnA and btnB

The application starts with formA

can you show me the code that... when I click on btnA in formA, It
will CLOSE formA and open formB...

Then when I click btnB from formB, it will close formB and open back
formA

See:

<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/1f74a1bd0a1f457b>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How close/open forms in Windows app? 3
BindingSource is not updated! 1
Duplicate A Form Object - Please Help 3
Active Event 2
Inter-related form 7
Forms question 2
Option Group - Blank Choice 5
Maximize Form 4

Back
Top