Loading Forms In VB.NET

J

Jams Al

I am new to VB.NET. I am trying to load a form (named switchboard)
from within a form (named login). But its not working. Following is my
code. What am I missing?

Dim Frm As New Switchboard
Frm.Show()

Thanks in advance.
 
C

Claes Bergefall

That code should work just fine. See if you can reproduce the problem in a
small sample and then post it here.

/claes
 
A

Armin Zingler

Jams Al said:
I am new to VB.NET. I am trying to load a form (named switchboard)
from within a form (named login). But its not working. Following is
my code. What am I missing?

Dim Frm As New Switchboard
Frm.Show()

You're probably coming from a VB classic background. Change your
understanding of 'load' as being an event, not a method. The load event
fires the first time before the Form is shown.
What are you trying to achieve?


Armin
 
P

Phill W.

Jams said:
I am new to VB.NET. I am trying to load a form (named switchboard)
from within a form (named login). But its not working.

Define "not working"

/What/ happens?
What error do you get?
Following is my code. What am I missing?
Dim Frm As New Switchboard
Frm.Show()

Is your "login" dialog Modal, i.e. did you put it on screen with
[login].ShowDialog()?

It certainly /used/ to be the case that you /couldn't/ "Show" a Form
from within one that you'd "ShowDialog'd".

HTH,
Phill W.
 
L

Lloyd Sheen

Jams Al said:
I am new to VB.NET. I am trying to load a form (named switchboard)
from within a form (named login). But its not working. Following is my
code. What am I missing?

Dim Frm As New Switchboard
Frm.Show()

Thanks in advance.

What are your options set to???

Set :
Option Strict On
Option Explicit On

Then most likely you will find out your problem.

LS
 
J

Jams Al

Hey

Thank you so much for your replies. I found out the problem.

I was using the following code.

Me.Dispose()
Dim Frm As New Switchboard
Frm.Show()

When I commented me.dispose, it works fine. But I do want to dispose
off the login form after loading switchboard. Where should I put this
code. Any ideas?

Thanks again.
 
J

Jams Al

I change the switchboard form to mdiparent form. This is the first
time I am using an mdi form.

After entering the details in the login form, the mdi parent form is
loaded. Then I want to dispose off the login form. Kindly advise.

Thanks
 

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

Top