Jump to content
  • Advertisement
Sign in to follow this  
Alpha_ProgDes

[.net] RangeValidator not validating...

This topic is 3401 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Protected Sub cmdB8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdB8.Click

        RangeValidator6.MinimumValue = txtB8Min.Text
        RangeValidator6.MaximumValue = txtB8Max.Text
        RangeValidator6.Type = ValidationDataType.Double
        Dim clearance As Double = Double.Parse(txtB6.Text) - Double.Parse(txtB7.Text)
        txtB8.Text = clearance.ToString()

        RangeValidator6.Validate()

        If (RangeValidator6.IsValid = False) Then
            txtB8.BackColor = Drawing.Color.Red
        Else
            txtB8.BackColor = Drawing.Color.White
        End If
    End Sub
IsValid keeps coming up as True, even though it should be False. What am I missing? If it helps the textboxes and buttons are in an updatepanel that's in a tabpanel. And validators are just in a tabpanel.

Share this post


Link to post
Share on other sites
Advertisement
Is your UpdatePanel's UpdateMode set to Always? If not, it may be that the validator isn't seeing a value in txtB8. That would result in a false positive since validation always succeeds on an empty control (unless you use a RequiredFieldValidator).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!