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


indy500fanAsked:
Who is Participating?
 
cyberdevil67Connect With a Mentor Commented:
Your code should read.

SetBlendLine.Show()

and not

BlendLine.Show()
0
 
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.