indy500fan
asked on
Error: Reference to a non-shared member requires an object reference.
Friends,
I am getting an error. Does anybody know how to fix it?
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetBlendLine = New BlendLine
BlendLine.Show()
End Sub
I am wanting to display a form upon Load of Main, and the code above is what I am using to do that. However, the line BlendLine.Show() is getting the error:
Reference to a non-shared member requires an object reference.
What does this mean?
The only reference that that form has to main is a variable:
Public Class BlendLine
Inherits System.Windows.Forms.Form
Dim OtherDecoder As String
Dim DecoderSet As String
Public Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOKbl.Click
Main.DecodersToUse = DecoderSet
Me.Close()
End Sub
Public Sub ckbUseAnotherDecoder_Check edChanged( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ckbUseAnotherDecoder.Check edChanged
OtherDecoder = txtOtherDecoder.Text
If ckbUseAnotherDecoder.Check ed = True Then
DecoderSet = ("250 or " & OtherDecoder)
ElseIf ckbUseAnotherDecoder.Check ed = False Then
DecoderSet = ("250")
End If
End Sub
End Class
I am getting an error. Does anybody know how to fix it?
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetBlendLine = New BlendLine
BlendLine.Show()
End Sub
I am wanting to display a form upon Load of Main, and the code above is what I am using to do that. However, the line BlendLine.Show() is getting the error:
Reference to a non-shared member requires an object reference.
What does this mean?
The only reference that that form has to main is a variable:
Public Class BlendLine
Inherits System.Windows.Forms.Form
Dim OtherDecoder As String
Dim DecoderSet As String
Public Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOKbl.Click
Main.DecodersToUse = DecoderSet
Me.Close()
End Sub
Public Sub ckbUseAnotherDecoder_Check
OtherDecoder = txtOtherDecoder.Text
If ckbUseAnotherDecoder.Check
DecoderSet = ("250 or " & OtherDecoder)
ElseIf ckbUseAnotherDecoder.Check
DecoderSet = ("250")
End If
End Sub
End Class
ASKER
cyberdevil67,
How do I fix that?
Thanks!
How do I fix that?
Thanks!
In Blendline, define show like this:
Public Shared Sub Show()
...
...
End Sub
By the way, I think your code is messed up anyway. Don't you mean to do this (which would not require a shared function in the first place)?
SetBlendLine = New BlendLine
SetBlendLine.Show()
Public Shared Sub Show()
...
...
End Sub
By the way, I think your code is messed up anyway. Don't you mean to do this (which would not require a shared function in the first place)?
SetBlendLine = New BlendLine
SetBlendLine.Show()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
cyberdevil67,
Duh, that was pretty dumb of me. Yep, that worked! Thanks
Duh, that was pretty dumb of me. Yep, that worked! Thanks
I could of sworn that was what I just said. Oh well - glad you got it working! :)
The joys of posting via a dialup, my comment made it in after yours....
It means the method Show in that class is erroring, and can't be of type non-shared.
Cheers!