Results 1 to 6 of 6

Thread: How do I validate a custome property value in a custom class?

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2007
    Posts
    36

    Re: How do I validate a custome property value in a custom class?

    Firstly, so you understand my level of knowledge - I'm a seasoned programmer (mainframe styley), but VB is a hobby, and one that I don't get too much exposure to.

    PropertyGridEx is a nice little extension of the standard Property Grid. It allows you to take any value (variable, property or control) and assign it to a Property Grid value. Essentially this means that the user can enter a value and the property value (in my example) gets updated automatically.

    But - the Property grid allows you to type an alpha value into a text box (naturally) even though the attached property is a double. So somewhere in between the text being entered and it reaching the property which is incompatible, I need to catch the error. Unfortunately it seems to be in no-mans land, and I can't intercept it. You can see the result of adding an "x" to a similar, integer property in the image below (I hope it shows up).

    I'm hoping there is a standard method for dealing with this situation.


  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: How do I validate a custome property value in a custom class?

    I don't think you can. Like you said the PropertyGrid is catching it before your property.
    You'd have to dig into the code for the p.g. class and see if you can copy it's behavior.
    Other than that, you're out of luck because your base class is where the problem is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width