robbremington
Member
- Joined
- Jan 6, 2003
- Messages
- 17
Error:
Reference to a non-shared member requires an object reference.
Question:
How do I amend this code to make it work?
Public Class Form1
Inherits System.Windows.Forms.Form
Dim NewClass1 As Class1
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
NewClass1 = New Class1()
Call NewClass1.Class1Sub() ***** Call Class1Sub
End Sub
Public Sub Form1Sub()
TextBox1.Text = "Yes"
End Sub
End Class
Public Class Class1
Public Sub Class1Sub()
Form1.Form1Sub() ****** this line is highlighted in error
End Sub
End Class
Reference to a non-shared member requires an object reference.
Question:
How do I amend this code to make it work?
Public Class Form1
Inherits System.Windows.Forms.Form
Dim NewClass1 As Class1
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
NewClass1 = New Class1()
Call NewClass1.Class1Sub() ***** Call Class1Sub
End Sub
Public Sub Form1Sub()
TextBox1.Text = "Yes"
End Sub
End Class
Public Class Class1
Public Sub Class1Sub()
Form1.Form1Sub() ****** this line is highlighted in error
End Sub
End Class