• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1518
  • Last Modified:

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_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ckbUseAnotherDecoder.CheckedChanged

        OtherDecoder = txtOtherDecoder.Text

        If ckbUseAnotherDecoder.Checked = True Then
            DecoderSet = ("250 or " & OtherDecoder)
        ElseIf ckbUseAnotherDecoder.Checked = False Then
            DecoderSet = ("250")
        End If

    End Sub
End Class


0
indy500fan
Asked:
indy500fan
  • 3
  • 2
  • 2
1 Solution
 
cyberdevil67Commented:
Hi indy500fan,

 It means the method Show in that class is erroring, and can't be of type non-shared.

Cheers!
0
 
indy500fanAuthor Commented:
cyberdevil67,

How do I fix that?

Thanks!
0
 
toddhdCommented:
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()
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
cyberdevil67Commented:
Your code should read.

SetBlendLine.Show()

and not

BlendLine.Show()
0
 
indy500fanAuthor Commented:
cyberdevil67,

Duh, that was pretty dumb of me.  Yep, that worked!  Thanks
0
 
toddhdCommented:
I could of sworn that was what I just said. Oh well - glad you got it working! :)
0
 
cyberdevil67Commented:
The joys of posting via a dialup, my comment made it in after yours....
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now