• 0
  • 69
  • 0

Add Buttons dynamically in the datagridview windows forms

May 6 2009 5:29 PM


I have a grid control. The number of columns in the grid are dynamic i.e they are not of fixed number. Only the first four columns are fixed and the rest of the columns depend on the scenario. so the columns in the grid will be 5,6,7,8 or 9 [ Greater than 4].

The data is present in the first four   columns. in the rest of the  columns the cells are empty. I need to insert a button in each of these empty cells.

My questions are

1. How to insert button control in these empty cells dynamically becuase i donno how many empty cells will be there

2. How should i handle the events of these added buttons.[ When i click a button, i get a pop up and i enter the data in that pop up, then i close the pop up]


Please Help me regarding this

Answers (2)