B
Brad Pears
I have an integer type database field that allows nulls. The associated
class property for this database (SQL Server 2000) field is of course also
an integer.
In my code (vb.net 2005), I am setting this property to a text box's ".text"
value. Now, depending on whether this is a new record or the user is
updating the record, the text box will either have an integer value in it or
will be null.
So, in my code where I am setting the class property I am getting an error
when the text box's .text property is null...
here is the code...
objPM.PostMasterID = me.txtPMID.text
At run time this will fail with an "input string was not in the correct
format" error.
My question is, is there a way to code this to handle the possiblity of the
null value in the text box?
The class property field is coded as shown below. In the properties "set"
code, I tried checking "value" for null and if so, set the actual property
to 0 but that also fails.
Any ideas what I could do to handle this?
Thanks, Brad
Public Property PostMasterID() As Integer
Get
Return iPMID
End Get
Set(ByVal value As Integer)
iPCID = value
End If
End Set
End Property
class property for this database (SQL Server 2000) field is of course also
an integer.
In my code (vb.net 2005), I am setting this property to a text box's ".text"
value. Now, depending on whether this is a new record or the user is
updating the record, the text box will either have an integer value in it or
will be null.
So, in my code where I am setting the class property I am getting an error
when the text box's .text property is null...
here is the code...
objPM.PostMasterID = me.txtPMID.text
At run time this will fail with an "input string was not in the correct
format" error.
My question is, is there a way to code this to handle the possiblity of the
null value in the text box?
The class property field is coded as shown below. In the properties "set"
code, I tried checking "value" for null and if so, set the actual property
to 0 but that also fails.
Any ideas what I could do to handle this?
Thanks, Brad
Public Property PostMasterID() As Integer
Get
Return iPMID
End Get
Set(ByVal value As Integer)
iPCID = value
End If
End Set
End Property