Wrong PropertyData Make Program Dead

2 posts, 0 answers
  1. Ji -Won
    Ji -Won avatar
    6 posts
    Member since:
    Sep 2011

    Posted 26 Jan 2012 Link to this post

    Im using PropertyGrid for my own class.
    that class have nonbasic type..
    that type is kind of class. ex) Point,SizeF
    If I try change Some Data at unexpand mode
    Look at example picture.
    at there if I write some bad string like "20,A"
    in typeconverter make exception but that exception make program dead.
    system.windows.form.propertygrid just show popupmessage.
    but radpropertygrid make program dead.

    even RadControl Demo also Dead.. please tell me about solution or fix that bug..

  2. Ivan Petrov
    Ivan Petrov avatar
    713 posts

    Posted 31 Jan 2012 Link to this post

    Hi Ji-Won,

    Thank you for writing.

    The reason why the exception is thrown and not internally handled is because we try to give as much flexibility to the developer as possible. This is why we have a validation mechanism where you can take care of the validation. You can read more about validation with RadPropertyGrid in our online documentation.

    Here is an example of how you can validate the case you have described using the PropertyValidating event:
    private void radPropertyGrid1_PropertyValidating(object sender, PropertyValidatingEventArgs e)
      PropertyGridItem item = e.Item as PropertyGridItem;
      if (item == null)
      if (item.PropertyType == typeof(Point))
          TypeConverter converter = item.TypeConverter;
        catch (Exception ex)
          e.Cancel = true;
          item.ErrorMessage = ex.Message;
        item.ErrorMessage = String.Empty;

    I hope this will be useful for you. If you have further question, I would be glad to help.

    Kind regards,
    Ivan Petrov
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Back to Top