Mihir
Mihir

Reputation: 8734

Unable to solve error "reference to a non-shared member requires an object reference. vb.net "

I have the following code

Case "Formula_MDX"
    Dim cubeid As String = Request("intCubeId")
    Dim strDimCode As String = Request("strDimCode")
    Dim strMdxFormula As String = Request("strMdxFormula")
    Dim result As String
    result =  HostAnalytics.HostAnalyzer.HostAnalyzer.setSubstituteVarMDXType(cubeid, strDimCode, strMdxFormula)

Case Else
Response.Write("Invalid call")
End Select

that vb method returns data of type string. I declared the result of the typed string. but it is showing on that vb method like

"reference to a non-shared member requires an object reference"

How to solve this? Did I make any other mistakes in this code?

Upvotes: 1

Views: 1956

Answers (1)

jonsca
jonsca

Reputation: 10381

Make an object of that type, and invoke the method on that

Dim ha As New HostAnalytics.HostAnalyzer.HostAnalyzer()  'Edit, need New
result = ha.setSubstituteVarMDXType(cubeid, strDimCode, strMdxFormula)

Upvotes: 2

Related Questions