Question: Do you know how to set property(if exist) to display all numeric value from object in hex format.
I use this code :

```
  OptionsDialog options = new OptionsDialog();
  options.OptionsPropertyGrid.SelectedObject = myobject //<--this object contains numeric value

```

Now on my object editor I can modify value but are display in decimal format.

Answer: 
Using a converter: 

```
public class IntToHexTypeConverter : TypeConverter
{
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
    {
        if (sourceType == typeof(string))
        {
            return true;
        }
        else
        {
            return base.CanConvertFrom(context, sourceType);
        }
    }

    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
    {
        if (destinationType == typeof(string))
        {
            return true;
        }
        else
        {
            return base.CanConvertTo(context, destinationType);
        }
    }

    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
    {
        if (destinationType == typeof(string) && value.GetType() == typeof(int))
        {
            return string.Format("0x{0:X8}", value);
        }
        else
        {
            return base.ConvertTo(context, culture, value, destinationType);
        }
    }

    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
    {
        if (value.GetType() == typeof(string))
        {
            string input = (string)value;

            if (input.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
            {
                input = input.Substring(2);
            }

            return int.Parse(input, NumberStyles.HexNumber, culture);
        }
        else
        {
            return base.ConvertFrom(context, culture, value);
        }
    }
}

```

Define a class for data to be associated with the PropertyGrid:

```
[DefaultPropertyAttribute("Name")]
public class Data 

public UInt32 stat;
[CategoryAttribute("Main Scanner"), DescriptionAttribute("Status"), TypeConverter(typeof(IntToHexTypeConverter ))]
public UInt32 Status
{
    get { return stat; }
}

```

Reference data for propertyGrid. (here, myData is a Data).

```
propertyGrid1.SelectedObject = myData;

```

Source: <http://koniosis.blogspot.nl/2009/02/integers-as-hex-in-propertygrid-c-net.html>
If you use string.Format(), you can specify how a numeric value should be displayed.

```
int i = 42;
string s = string.Format("Display as integer: {0}, or as hex: 0x{0:X}", i);

Console.Out.WriteLine(s);

```