Validation

Phillh

Newcomer
Joined
Apr 2, 2003
Messages
7
Location
Cirencester
Hi All...

This has been driving me bonkers all day...

I am running this code below to validate a user entry in a textbox is an integer:
Visual Basic:
If txtqty.Text = "" Then
            strqty = "Enter a number only for quantity."
        Else
            vd1.ControlToValidate = "txtqty"
            vd1.Operator = ValidationCompareOperator.DataTypeCheck
            vd1.Type = ValidationDataType.Integer
            vd1.ErrorMessage = "Enter a number only for quantity."
            vd1.Validate()
            If vd1.IsValid = False Then strqty = vd1.ErrorMessage
        End If
and I keep getting...

Object reference not set to an instance of an object.

at the v1.validate() bit...

Any Ideas....Thanks

Phill
 
Last edited by a moderator:
validation

Thanks for the reply...

I had declared the validationbox vd1 earlier on in the code I just didn't copy into the form..sorry.

I got around it in the end by just using the standard validation controls and then using the summary sheet at the end to display all the errors...

thanks again....I do have new issue though (you have probably guessed i'm new to .NET :D )

I have a link button which I use on a webform to submit the data entered to a SQL database which works fine and uses the above validation...I want the button to also link to a page after the submit which says "Your entry has been submited" etc etc and display it...I have the page built just need to know how to display it using thye linkbutton as oppsed to the hyperlink control which I can't use as I need to run the click_event fist.

Thanks

Phill :)
 
Back
Top