adding a new windows form to my vb.net project

  • Thread starter Thread starter locutus
  • Start date Start date
L

locutus

Guest
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
 
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:

Visual Basic:
Dim X As frmSecond = New frmSecond()
X.Show()
 
Back
Top