Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by PlausiblyDamp
Posted

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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...