Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Value of integer member variable in webservice

Status
Not open for further replies.

lpatnaik

Programmer
Jul 11, 2002
53
Hi,
I have developed a webservice with some functions. I have a public class(in the same webservice file but outside the webservice class) called TestDO which has a number of member variables, some of which are integer. In some functions of my webservice, I am sending this TestDO as a parameter so that the client can create an instance of this class and fill in the values for its member variables and call the respective function.
The problem lies in the fact that if the client leaves some of the integer member variables unfilled, these variables default to 0, when I want them to be Null (or a negative value that i set in the constructor of the class - I tried this in the default constructor, but it is not working).
Kindly help Asap.
Lopa
 
What does your constructor look like? That's definitely the way to set default values. Code please.

:)
paul
penny1.gif
penny1.gif
 
My class is :
Public Class TestCaseDO
Public TestCaseID As Integer
Public ProjectID As Integer = 8
Public Enabled As Boolean
Public UserRoles() As String

Public Sub New()
MyBase.New()
ProjectID = -1
End Sub
Public Sub New(ByVal intValue As Integer)
MyBase.New()
ProjectID = intValue
End Sub
End Class

'Neither of these constructors are working i.e. none of these are setting projectid to -1 or the value sent.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top