How to Webservice returning String() in VB.NET

A

adh

Possible in C# but not in VB.NET 2005 ????

<WebMethod()> _
Public Function GetCompletionNames(ByVal prefixText As String, ByVal count
As Integer) As String()
Dim st as String()
......
return st

Doesn't work !!???

Thanks
 
J

John Saunders [MVP]

adh said:
Possible in C# but not in VB.NET 2005 ????

<WebMethod()> _
Public Function GetCompletionNames(ByVal prefixText As String, ByVal count
As Integer) As String()
Dim st as String()
.....
return st

In what way does it not work?
 
A

adh

VB.NET does not return the string array like C# does.
Testing the webservice goes to the Not Found Page, while in C# you get
the Array-XML

Thanks, adh
 
A

adh

See MS Controls Toolkit: AutoCoplete which ask for a string() result.
Works fine in C# but not with a VB <webmethod>
I prefer it in VB because I need to Cash the (big) answer base.
Thanks, adh
 
J

John Saunders [MVP]

adh said:
VB.NET does not return the string array like C# does.
Testing the webservice goes to the Not Found Page, while in C# you get
the Array-XML

VB.NET and C# have identical capabilities here. You must have done something
wrong in the VB code that you did correctly in C#.

Does the VB code return nothing? Does it throw an exception?
 
A

adh

Nothing Wrong (!) and it doesn't throw an exeption, just does not get
the result and goes to the web not found.

I have seen more posts about it. Like using the line:
<System.Web.Script.Services.ScriptService()> _
which (at least in VB2005) is not recognized (ScriptService
is in System.Web.Script.Services)
Thanks, adh
 
J

John Saunders [MVP]

adh said:
Nothing Wrong (!) and it doesn't throw an exeption, just does not get
the result and goes to the web not found.

I have seen more posts about it. Like using the line:
<System.Web.Script.Services.ScriptService()> _
which (at least in VB2005) is not recognized (ScriptService
is in System.Web.Script.Services)

There is no issue of "recognition". Import the namespace and try it again.
 
A

adh

You Tried?
ScriptService is not included in definition of
System.Web.Script.Services
Not in VB.NET2005
Thanks, adh
 
J

John Saunders [MVP]

adh said:
You Tried?
ScriptService is not included in definition of
System.Web.Script.Services
Not in VB.NET2005

Namespaces have nothing to do with languages. If the namespace is absent in
VB.NET 2005, then it's absent in .NET.

More likely, you aren't aware of how, in VB, to add a reference to the
assembly containing the System.Web.Script.Services namespace. Look in your
C# project and find out what reference you had to add, then add that
reference to the VB project.
 
A

adh

Done all the same (I still know to copy....;-)
Please try a WebService yourself and see.

Thanks, adh
 
J

John Saunders [MVP]

adh said:
Done all the same (I still know to copy....;-)
Please try a WebService yourself and see.

Believe what you like. VB.NET doesn't cause namespaces to be inaccessible,
and that namespace is not part of VB.NET.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top