Jump to content
Xtreme .Net Talk

adding a new windows form to my vb.net project


Recommended Posts

Posted

Hi

I have added a second form to my project in the .net studio but when I code a button on the main form with

frmAccounts.show it is highlighted as an error with the message "this reference to a non shared member requires an object reference and none is supplied"

 

what is this all about ? and how do I fix this ? , boy this .net is not as straight forward as other VB versions I have mucked about with , I am feeling kinda lost but will stick with it.

 

Thx for any help.

Locutus

  • *Gurus*
Posted

It doesn't let you get away with certain things you may have been used to getting away with in previous VB version, is all. One of these is implicitly creating an instance of a form with the same name as the form. In .net, you need to create an instance yourself, and pass it around to anything that needs it:

 

Dim X As frmSecond = New frmSecond()
X.Show()

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...