"cj2" <cj2@nospam.nospamwrote in message
news:eRB3jl$SJHA.588@TK2MSFTNGP06.phx.gbl...
Quote:
Which function shows the proper way to return this structure
Validate, Validate2, or Validate3? And a short why would be nice.
>
Public Class Validate
Inherits System.Web.Services.WebService
>
Public Structure ValResult
Dim mResponse As String
Dim mReason As String
End Structure
>
<WebMethod()_
Public Function Validate(ByVal ibtn As String, ByVal irequestor As
String)
Dim thisResult As New ValResult
thisResult.mResponse = "ALLOW"
thisResult.mReason = "Good"
Return thisResult
End Function
>
<WebMethod()_
Public Function Validate2(ByVal ibtn As String, ByVal irequestor
As String) As ValResult
Validate2.mResponse = "ALLOW"
Validate2.mReason = "Good"
Return Validate2
End Function
>
<WebMethod()_
Public Function Validate3(ByVal ibtn As String, ByVal irequestor As
String) As ValResult
Dim thisResult As New ValResult
thisResult.mResponse = "ALLOW"
thisResult.mReason = "Good"
Return thisResult
End Function
End Class
Validate3 is my choice, because I hate the other two.
Validate does not convey a return type. Validate2 does the work in a very
vb6 way in that the function name is treated as the return variable.