Click to See Complete Forum and Search --> : web service public variable, Compiler Error Message: BC30456


gabrielgv
09-15-2006, 07:13 PM
Hi:

I have programmed a Web Service called Customer.asmx.

This is the code:

<%@ WebService Language="VB" Class="Customer"%>
Imports System.Web.Services
<WebService(Namespace:="DigitalSnd1")> _
Public Class Customer
Public Name As String
<WebMethod()> Public Sub Custname()
Name="The name is John"
End Sub
End Class



I also have programmed an aspx to call this Web Service

<%@ Page Language="VB" Debug="true"%>
<html>
<head>
<title>Customer</title>
</head>
<body>
<%
Dim theCustom As new Customer()

theCustom.Custname()
%>
<%=theCustom.Name%>
</body>
</html>

I get an error at this line

<%=theCustom.Name%>

Compiler Error Message: BC30456: 'Name' is not a member of 'Customer'.



What Could be wrong If I have "Name" declared as public variable in the web service code??

Thanks!!

sirpelidor
09-16-2006, 02:29 AM
<%@ WebService Language="VB" Class="Customer"%>
Imports System.Web.Services
<WebService(Namespace:="DigitalSnd1")> _
Public Class Customer
Public Name As String
<WebMethod()> Public Sub Custname()
Name="The name is John"
End Sub
End Class

<%=theCustom.Name%>
Compiler Error Message: BC30456: 'Name' is not a member of 'Customer'.


if you ignore all the cool web services thingie and break thie code down the basic method, you will see something like this:


public sub Custname()
dim name = "The name is John"
end Sub



again, forget those web services tool.... just call those method using another class (assume this method is wrapped by another class)


dim myClass = someClass()
myClass.Custname.name <-- now do u see what's wrong?