i get 1 error
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

here is my code

Public Class test
    Private _course As String
    Public Shared Function function1(ByVal data As String) As Boolean

    ' Code 
    ' bla bla bla
    ' ....
        process(x, y)
        Return True
    End Function


    Private Shared Sub process(ByVal x As String(), ByVal y As String)

    ' Code 
    ' bla bla bla
    ' ....

            course = x(0)      '<-------- HERE!!!!
End Sub


    Property course() As String
        Get
            Return _course
        End Get
        Set(ByVal value As String)
            _course = value
        End Set
    End Property
End Class

what is wrong?and how can i fix it?

To use course() in the manner that fits the implementation of the class, you would need to establish an instance of the class.

Dim mytest As New test()
        mytest.course = x(0)

To use it the way you are trying to use it, you would need to make course() and _course Shared members of the class instead of instance members.

Private Shared _course As String

    Private Shared Property course() As String
        Get
            Return _course
        End Get
        Set(ByVal value As String)
            _course = value
        End Set
    End Property

Go with whichever way fits your needs.

Oh thanks for your reply
but which one is better?
i don't know too much about OOP
i want to make a method that reformat some data
and call it many times in my Main form
like

test.fuction1("take the 1st string split it")
debug.console(test.course)
test.fuction1("take 2nd string and split it and then save it to properties")
...
...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.