views:

37

answers:

1

Hi, I have to develop a small app for which I have to create a user control which is intended to be something like a Table View.

On Form Load, the user should be asked about the number of rows of columns required on the form.

Once the user sets the number of cells, each cell should have a button and a Text Box inside it (grouped together). Please help me in creating the User Control. I am still a new learner. Thanks!

+2  A: 

The DataGridView built-in class in the .NET Framework will display a grid with a text box that can be edited by a user. To display an image you'll need to derive your our DataGridViewCell and write all the drawing and handling code to customize the cell. You can see this example for how to do that:

http://www.codeproject.com/KB/grid/DGV_ImageButtonCell.aspx

Another option would be to use a TableLayoutPanel. After the user specifies the number of rows and columns, you could create the TableLayoutPanel then iterate through each cell to add the appropriate control.

Each cell can only have 1 control so you'd have to make two columns to put a button and textbox next to each other.

Chris Thompson