entering hex format into datagrid backed by int

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sklett

    entering hex format into datagrid backed by int

    I have the need to enter a hex value IE: 0xffff into a datagrid column that
    is backed by an int property for a custom object.

    in other words, I have a class like this:
    class MyEntity
    {
    private int _start = 0;

    public int Start
    {
    get{ return _start; }
    set{ _start = value; }
    }
    }

    in the DataGridView if I enter 0xffff I get format exceptions.

    Anyone have some tips or ideas how I can get this to work? Where I should
    look?

    Thanks for any help!

    -Steve


  • Dave Sexton

    #2
    Re: entering hex format into datagrid backed by int

    Hi Steve,

    Try using the DataGridView's custom display formatting and input parsing events, CellFormatting and CellParsing, respectively.


    --
    Dave Sexton

    "sklett" <s@s.comwrote in message news:u3merfI7GH A.4304@TK2MSFTN GP03.phx.gbl...
    >I have the need to enter a hex value IE: 0xffff into a datagrid column that is backed by an int property for a custom object.
    >
    in other words, I have a class like this:
    class MyEntity
    {
    private int _start = 0;
    >
    public int Start
    {
    get{ return _start; }
    set{ _start = value; }
    }
    }
    >
    in the DataGridView if I enter 0xffff I get format exceptions.
    >
    Anyone have some tips or ideas how I can get this to work? Where I should look?
    >
    Thanks for any help!
    >
    -Steve
    >

    Comment

    • sklett

      #3
      Re: entering hex format into datagrid backed by int

      Dave, worked perfect!

      Thank you,
      Steve

      "Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
      news:uU227QP7GH A.4708@TK2MSFTN GP05.phx.gbl...
      Hi Steve,
      >
      Try using the DataGridView's custom display formatting and input parsing
      events, CellFormatting and CellParsing, respectively.
      >
      >
      --
      Dave Sexton
      >
      "sklett" <s@s.comwrote in message
      news:u3merfI7GH A.4304@TK2MSFTN GP03.phx.gbl...
      >>I have the need to enter a hex value IE: 0xffff into a datagrid column
      >>that is backed by an int property for a custom object.
      >>
      >in other words, I have a class like this:
      >class MyEntity
      >{
      > private int _start = 0;
      >>
      > public int Start
      > {
      > get{ return _start; }
      > set{ _start = value; }
      > }
      >}
      >>
      >in the DataGridView if I enter 0xffff I get format exceptions.
      >>
      >Anyone have some tips or ideas how I can get this to work? Where I
      >should look?
      >>
      >Thanks for any help!
      >>
      >-Steve
      >>
      >
      >

      Comment

      Working...