Author Topic: Add control to a property grid  (Read 3087 times)

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Add control to a property grid
« on: July 31, 2015, 01:38:05 AM »
For those who might find it useful, here is a link that shows how to add NumericUpDown control to a property grid:

http://stackoverflow.com/questions/14291291/how-to-add-numericupdown-control-to-custom-property-grid-in-c

It is in C# but can be converted to VB Net and modified to produce the results as in the attached pictures. So far I've tried the NumericUpDown and TrackBar controls but the logic suggests that other controls could be added as well.

This way a user can select numbers directly, which "Enum" statement doesn't seem to be capable of, and the range could be adjusted for example to show only odd or only even numbers or increment the value any way you'd like. It is generally suitable for predefined range of values.

A new class might need to be created for different properties if the range and type of values are different.

Here is another link with identical subject that is presented in rather colorful way, that has code in VB Net:

http://www.codeproject.com/Articles/28984/Rich-Design-Time-Editing-with-UITypeEditors-VB-NET

Actually, this might be a better choice for those who decide to give it a try.

Here is an example of control that is using both NumericUpDown and Trackbar:
https://www.advancedhmi.com/forum/index.php?topic=673.msg4955#msg4955
« Last Edit: May 20, 2019, 12:59:32 AM by Godra »