Question reference to a non shared member requires an object reference

Joe1

Active member
Joined
Dec 4, 2012
Messages
37
Programming Experience
Beginner
Hi,

I have to button on a winform used to make another winform visible. but i am getting the error "reference to a non shared member requires an object reference"
on the line

ParameterSelection.Visible = True where parameterselection is the name of the winform.

Im new to VB so has anybody got any advice as to where the error may be coming from?

Cheers
 
Firstly, you would call Show rather than set Visible to True. As for the question, that code should theoretically display the default instance. If it's not working then that suggests that that form has no default instance, which would happen if it did not have a parameterless constructor. Did you add your own constructor, i,e, New method, to that form?
 
Okay, i also tried the Show option which produces the same error as expected. What I am actually trying to do is reopen a form that is enabled but hidden, so using a 'new' method does work, but opens a new version if the form.
I am trying to re-show the form which already has user selected options.
 
That's probably information that you should have provided in the first place. In that case, when you create the form in the first place, assign it to a variable. You can then access it from that variable later in order to show it again.
 
Back
Top