Phillh Posted April 8, 2003 Posted April 8, 2003 (edited) 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: 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 Edited February 19, 2007 by PlausiblyDamp Quote
Moderators Robby Posted April 8, 2003 Moderators Posted April 8, 2003 you did not decalre vd1 Quote Visit...Bassic Software
Moderators Robby Posted April 8, 2003 Moderators Posted April 8, 2003 you can also have a look at this thread to check on numerics... http://www.xtremedotnettalk.com/showthread.php?s=&threadid=71139 Quote Visit...Bassic Software
Phillh Posted April 9, 2003 Author Posted April 9, 2003 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.