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

Simple how to open a form

P: n/a
If I have a project with 2 or more forms..
form(1) has a button to open form(2)

What is the code for opening for(2)?
Ex: form(2).show

This doesnt work. Simply anyways.
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
dim frm2 as new form2
frm2.show

--
_____________________________________________
Este é um grande mail de comunicação
Daniel Sélen Secches
ICQ 961630
"Mike D" <di****@hotmail.com> escreveu na mensagem
news:OR**************@TK2MSFTNGP09.phx.gbl...
If I have a project with 2 or more forms..
form(1) has a button to open form(2)

What is the code for opening for(2)?
Ex: form(2).show

This doesnt work. Simply anyways.

Nov 20 '05 #2

P: n/a
"Mike D" <di****@hotmail.com> schrieb
If I have a project with 2 or more forms..
form(1) has a button to open form(2)

What is the code for opening for(2)?
Ex: form(2).show

This doesnt work. Simply anyways.


It's been asked and answered few hours ago.

<quote>
Where did you declare the variable Form2?

more info:
http://msdn.microsoft.com/library/en...delessForm.asp
</quote>
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #3

P: n/a
I tried that. It isnt bringing up my form. It is bringing up a grey form.
"Daniel Sélen Secches" <daniel@cwdPONTOcomPONTObr> wrote in message
news:ey*************@tk2msftngp13.phx.gbl...
dim frm2 as new form2
frm2.show

--
_____________________________________________
Este é um grande mail de comunicação
Daniel Sélen Secches
ICQ 961630
"Mike D" <di****@hotmail.com> escreveu na mensagem
news:OR**************@TK2MSFTNGP09.phx.gbl...
If I have a project with 2 or more forms..
form(1) has a button to open form(2)

What is the code for opening for(2)?
Ex: form(2).show

This doesnt work. Simply anyways.


Nov 20 '05 #4

P: n/a
This doesn't seem to work either

This seems to be creating a form on the fly and opening it.

I have 2 forms already created.
(1)frmLogin
(2)frmSecure_close

On form (1) I have a button (btn)
on the on click event of the (btn)
dim frmSecure_close as form
frmSecure.show
-- This does work however it is just creating the form on the fly and opeing
a blank grey form.

I need my form already created to open..
>>>

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl... "Mike D" <di****@hotmail.com> schrieb
If I have a project with 2 or more forms..
form(1) has a button to open form(2)

What is the code for opening for(2)?
Ex: form(2).show

This doesnt work. Simply anyways.
It's been asked and answered few hours ago.

<quote>
Where did you declare the variable Form2?

more info:

http://msdn.microsoft.com/library/en...delessForm.asp </quote>
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #5

P: n/a
object reference not set to an instance of an object.

"Mike D" <di****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
This doesn't seem to work either

This seems to be creating a form on the fly and opening it.

I have 2 forms already created.
(1)frmLogin
(2)frmSecure_close

On form (1) I have a button (btn)
on the on click event of the (btn)
dim frmSecure_close as form
frmSecure.show
-- This does work however it is just creating the form on the fly and opeing a blank grey form.

I need my form already created to open..
>>>>
"Armin Zingler" <az*******@freenet.de> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
"Mike D" <di****@hotmail.com> schrieb
If I have a project with 2 or more forms..
form(1) has a button to open form(2)

What is the code for opening for(2)?
Ex: form(2).show

This doesnt work. Simply anyways.


It's been asked and answered few hours ago.

<quote>
Where did you declare the variable Form2?

more info:

http://msdn.microsoft.com/library/en...delessForm.asp </quote>
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html


Nov 20 '05 #6

P: n/a
"Mike D" <di****@hotmail.com> schrieb
This doesn't seem to work either

This seems to be creating a form on the fly and opening it.

I have 2 forms already created.
(1)frmLogin
(2)frmSecure_close

On form (1) I have a button (btn)
on the on click event of the (btn)
dim frmSecure_close as form
frmSecure.show
-- This does work however it is just creating the form on the fly and
opeing a blank grey form.
This does not work because it would throw a NullReferenceException because
frmSecure_close is still Nothing because you did not assign a Form object to
frmSecure.
I need my form already created to open..


If you want to access an object you need a reference. If you don't have a
reference you make it available. This is usually done by a public property
or passing it as a procedure argument.
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #7

P: n/a
dim frmSecure_close as form
frmSecure.show


No not "as form" but "as new frmSecure_close

Like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim frm2 As New frmSecure_close
frm2.ShowDialog() 'or use frm2.show
End Sub

Good Luck!
Shawn Shelton

Nov 20 '05 #8

P: n/a
On Tue, 4 Nov 2003 13:02:07 -0500, Mike D wrote:
I have 2 forms already created.
(1)frmLogin
(2)frmSecure_close
Do you mean that you have already instantiated them? Or do you mean that
you have already created them in the IDE'd designer?
On form (1) I have a button (btn)
on the on click event of the (btn)
dim frmSecure_close as form
frmSecure.show


frmSecure_close is the "class name", not the name of the actual form
object. You need to use the following:

'Create an instance of the frmSecure_close class, and call it MyForm
Dim MyForm As New frmSecure_close

'Now that we have an instance (called MyForm), show that instance.
MyForm.Show
--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.