newbie help again....

M

Malakie

Hi:

As mentioned in a previous post, I am just starting to TRY and learn
VB.Net.... but damn if I am no struggling. Anyhow, no matter how I search
in help, I cannot seem to find anything that tell me how to do one very
simple thing... show a form!

I have three forms in a test project. form1, form2 and form3. form1 has a
command button on it. Obviously I tried the form2.show as in VB6 but I now
know that does not work and everything I know or knew, or thought I
understood is out the window. So how do I simply tell vb that when I click
the button I want form2 to show?
 
S

Simon Jefferies

It should be as simple as:-

Dim MySecondForm As New Form2
MySecondForm.Show()

You need to create an instance of your form rather than using the Show
directly onto your Form2 class.

Cheers
Simon
(e-mail address removed)
 
M

Malakie

Thanks for the quick help. Apparently I need to throw everything I learned
about VB6 out the window and start over. Looks like my main coding will
have to continue in VB6 until I am able to spend more time getting up to
speed on .Net. I did not realize the changes were so dramatic and for
someone like me, it is like it is a completely new and different language...
so much for being able to jump in and learn as I go in a quick manner.
 
S

Simon Jefferies

Yes, I agree. I've come from a VB6 background too and it does take a while
to get your head around it all!

Having proper object orientation and just way the whole .NET is put
together - but the one thats taken the
longest for me to get around is that .NET itself controls instances of your
objects rather than you.
It all depends on how many of your variables refer to the actual object
(good old reference counting and garbage
collection now!)

Also, you used to use ByRef in VB6 to change things, but now its recommended
to avoid this because of the above!

But, on the big +side, it is well worth learning and sticking with it -
there are so many useful classes in the framework and proper
OOP in VB is so bliss! The only way I've learned is to experiment and
practice different methods.

Simon
 
K

Ken Tucker [MVP]

Hi,


Try something like this.

Dim frm as new Form2
frm.show

Ken
-----------------
Hi:

As mentioned in a previous post, I am just starting to TRY and learn
VB.Net.... but damn if I am no struggling. Anyhow, no matter how I search
in help, I cannot seem to find anything that tell me how to do one very
simple thing... show a form!

I have three forms in a test project. form1, form2 and form3. form1 has a
command button on it. Obviously I tried the form2.show as in VB6 but I now
know that does not work and everything I know or knew, or thought I
understood is out the window. So how do I simply tell vb that when I click
the button I want form2 to show?
 
C

Chris Dunaway

it is like it is a completely new and different language...

That's the way you should look at it. VB.Net is *not* an upgrade to VB6.
Think of it as an entirely new language that just happens to share similar
syntax to VB6. Once you start to learn VB.Net, you'll like what you can do
with it.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

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