Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Getting a PropertyGrid to display a value in Hex

Getting a PropertyGrid to display a value in Hex

Scheduled Pinned Locked Moved C#
csstutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    melchizedek
    wrote on last edited by
    #1

    I feel like this should be obvious, but I haven't found it yet. Does anyone know how to get a Property Grid to display an int or byte property value in hex?

    "We may not be the smartest in the world, but we're the smartest you've got." -a co-worker, speaking to our manager

    P 1 Reply Last reply
    0
    • M melchizedek

      I feel like this should be obvious, but I haven't found it yet. Does anyone know how to get a Property Grid to display an int or byte property value in hex?

      "We may not be the smartest in the world, but we're the smartest you've got." -a co-worker, speaking to our manager

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Call ToString("X") on your int/byte variable to return a string representation of its value in hexadecimal format.

      Paul Marfleet

      V 1 Reply Last reply
      0
      • P pmarfleet

        Call ToString("X") on your int/byte variable to return a string representation of its value in hexadecimal format.

        Paul Marfleet

        V Offline
        V Offline
        visualhint
        wrote on last edited by
        #3

        To be a bit more precise, do this kind of conversion in a TypeConverter (a converter derived from Int32Converter for example) ConvertFrom/ConvertTo methods and attach this converter to your property thanks to the TypeConverterAttribute.

        Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker

        M 1 Reply Last reply
        0
        • V visualhint

          To be a bit more precise, do this kind of conversion in a TypeConverter (a converter derived from Int32Converter for example) ConvertFrom/ConvertTo methods and attach this converter to your property thanks to the TypeConverterAttribute.

          Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker

          M Offline
          M Offline
          melchizedek
          wrote on last edited by
          #4

          Thanks for the help. I was hoping that I could set a property on the PropertyGrid to show all of the objects integer types as hex (like in the watch display in the debugger), but I'll proceed with the TypeConverter. Regards.

          "We may not be the smartest in the world, but we're the smartest you've got." -a co-worker, speaking to our manager

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups