1

I would like to add multiple buttons to a datagridviewbuttoncell

imagine 1 column contains a simple integer count

the button column next to it would have 2 buttons, one + and one -

then for example subscribe the click events to increment or decrement the text column counter following if + or - was clicked

is this possible ?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
crazyghandi
  • 49
  • 1
  • 10
  • Why not to add two columns - one for "+" button and one for "-" button? – sasha_gud Aug 03 '14 at 15:01
  • yes i thought about that and it works of course ;-) but i think in 1 column is an economy of space and its nicer. I've been searching on google but doesn't look like there's a simpler way than painting the buttons in position which is a pain – crazyghandi Aug 03 '14 at 15:08
  • and i think i've seen it being done before though i can't remember where – crazyghandi Aug 03 '14 at 15:11

1 Answers1

1

I doubt you can easily modify DataGridViewButtonCell. But you can always create your own control and put in a cell like described here: How to place a custom control within a cells of datagridview in window form

1) Create custom control, implement IDataGridViewEditingControl IDataGridViewEditingControl Interface.

2) How to: Host Controls in Windows Forms DataGridView Cells

Community
  • 1
  • 1
sasha_gud
  • 1,635
  • 13
  • 18