(Reference to a non-shared member requires an object reference) Help
Ok I have 2 listbox, a panel, and a user control with a textbox on it.
When I click on listbox1 listbox2 is filled with data and the user control is loaded into a panel. This is where I need help: I'm supose to be able to click listbox2 once it's filled with data and have a textbox on the user control fill with some text.
Here's the part of code for listbox2 I am having troble with.
'BipedEditor.Textbox1 is the textbox loacated on the user control
'Reference to a non-shared member requires an object reference is the error I get for the text in pink
'It's because the textbox isn't on the form that this code is on
BipedEditor.TextBox1.Text = BR.ReadSingle
BR.Close()
End
If
BipedEditor is the user control
Textbox1 is the textbox on the user control
How do I reference a non-shared member?
The text in red is where I get the error
Error Reference to a non-shared member requires an object reference.
Forerunner.BipedEditor.JumpHeightBOX.Text = ("Test1")
-Things you should know
-The code above is on the main form and it's calling a texbox named JumpHeight thats on the form BipedEditor
-Forerunner is the project
Anyone know?
Thanks in advance
You are referencing that textbook via it's non-instantiated name.
That form is a class and has been instantiated. You need to find out what name it's instantiated in and
address it as instance.JumpHeight.Text.
Another way i've found is to simply create a Module1.vb in which you declare:
Public Form1_Clone as New Form1 'Form1 is as normally designed Form but in .Net it is considered as a class
Public Form2_Clone as New Form2 'Form2 is as normally designed Form but in .Net it is considered as a class
.
.
and so on
When you whish to "Show" a form, call Module1.Form1_Clone.Show()
From where ever you whish to access control objects on Form1_Clone (which is now displayed), simply use Form1_Clone.TextBox1.Text
Hope this help.