This message was discovered on ASPFriends.com 'winforms-cs' list.
| m.bhairavi |
Dear all,
I want to add controls to a datagrid within a winforms form. I am able to do this in webforms can anyone help me to do the same in winforms.
with regards, m.b
|
|
| |
| |
| Stephen Rees |
There are some good downloadable examples at CSharpCorner.com
Ther are different ways of doing it, ie. extending the TextBoxColumn into say a ComboColumn (Marc Boulter did this)..... or you can do it all in a single file as well I believe. I prefer Marc Boulters way, his combo is probably as difficult as it's going to get - so get this sorted and then you can alter it for any type of column. Do search at aspallience .. they have the Marc Boulters version somewhere - I do too but I really don't know what I've done with it, it was a while ago and my examples are everywhere now, incl. cd's. If you get stuck finding it, post again, and I'll find mine.
Also search these lists in the VB sections, I believe there's some good info/links within.
I think there's downloadable versions at gotdotnet.com also.
There's also many 3rd party very nice ones - try devexpress.com, devexpress have some very neat software, I'd love to know how to do it all - one day and a lot of hours eh ? DevExpress will give you the code for a few more bucks, if I had the money I would definately pay for their code.
Steve.
-----Original Message----- From: m.bhairavi [mailto:Click here to reveal e-mail address] Sent: 15 June 2002 00:28 To: winforms-cs Subject: [winforms-cs] how to add controls to a datagrid Sensitivity: Confidential
Dear all,
I want to add controls to a datagrid within a winforms form. I am able to do this in webforms can anyone help me to do the same in winforms.
with regards, m.b | [winforms-cs] member Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/asplists/winforms-cs.asp = JOIN/QUIT
|
|
| |
|
| |
| Paul Smith |
Hi, I have managed to add controls to a windows datagrid but I am not sure if my method of doing so is reliable. Please comment.
I have a static int which is incremented in the datagrid's ControlAdded event. It seems that the event is fired everytime the first DataGridTextBox in a grid column is created. if the static counter corresponds to the correct column number, as I have set it out, I add the control.
Ideally, I would like to get the DataGridTextBox control which is passed with the ControlEventArgs and determine which column it came from via one of its properties. I have been unable to do this so far.
private System.Windows.Forms.DataGrid dataGrid1; private System.Windows.Forms.ComboBox cmbClub; private System.Windows.Forms.DateTimePicker dtpDOB; private System.Windows.Forms.DateTimePicker dtpRegDate;
static int gridColCounter;
public MyForm(){
controlCounter = 0; //create controls to be add this.cmbClub = new System.Windows.Forms.ComboBox(); ... //add an eventhandler to the datagrid this.dataGrid1.ControlAdded += new ControlEventHandler(this.DataGrid_ControlAdded); }
private void DataGrid_ControlAdded(object sender, ControlEventArgs e){
System.Windows.Forms.Control.ControlCollection cons = e.Control.Controls; if(gridColCounter == 5) cons.Add(dtpDOB); if(gridColCounter == 6) cons.Add(dtpRegDate); if(gridColCounter == 7) cons.Add(cmbClub); dgColCount++; } ----- Original Message ----- From: m.bhairavi To: winforms-cs Sent: Saturday, June 15, 2002 9:28 AM Subject: [winforms-cs] how to add controls to a datagrid
Dear all,
I want to add controls to a datagrid within a winforms form. I am able to do this in webforms can anyone help me to do the same in winforms.
with regards, m.b | [winforms-cs] member Click here to reveal e-mail address = YOUR ID | http://www.asplists.com/asplists/winforms-cs.asp = JOIN/QUIT
|
|
| |
|
|
|
|
|