By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,761 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,761 IT Pros & Developers. It's quick & easy.

How to Insert User Control into DataGrid Cell

P: n/a
How do insert a user control i have created into a datagrid cell.
Basically i am trying to create a column of my user controls. This is
what i have tried so far.
int i = 0;
while (i < dsSignIn1.Tables["Contacts"].Rows.Count)
{
SignatureControl.SignatureControl sig1 =
new SignatureControl.SignatureControl();
Point p1 = new Point(dgSignIn.GetCellBounds(i,3).X,dgSignIn.GetCe llBounds(i,3).Y);//,dgSignIn.GetCellBounds(i,0).Y);
MessageBox.Show(this,p1.ToString());
sig1.Location = p1;
this.Controls.Add(sig1);
i++;
}

I get the cooulmn of the user controls but they show up on the form
behind the datagrid.

How can i get them on the datagrid?
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I have not done this before, but I remeber seeing that you can add a control
to a Datagrid cell by addin it to the Controls collection of the cell. You
are adding it to the Controls collection of the form now, just positioning
it at the same place as your cell.

Here is a related link used for updating values in a web datagrid:
http://msdn.microsoft.com/library/de...us/dv_vbcode/h
tml/vbtskcodeupdatingitemsindatagridordatalistwebcontr olvisualbasic.asp

Telmo Sampaio
"Tolga" <to**********@hotmail.com> wrote in message
news:f6**************************@posting.google.c om...
How do insert a user control i have created into a datagrid cell.
Basically i am trying to create a column of my user controls. This is
what i have tried so far.
int i = 0;
while (i < dsSignIn1.Tables["Contacts"].Rows.Count)
{
SignatureControl.SignatureControl sig1 =
new SignatureControl.SignatureControl();
Point p1 = new Point(dgSignIn.GetCellBounds(i,3).X,dgSignIn.GetCe llBounds(i,3).Y);//,dgSign
In.GetCellBounds(i,0).Y); MessageBox.Show(this,p1.ToString());
sig1.Location = p1;
this.Controls.Add(sig1);
i++;
}

I get the cooulmn of the user controls but they show up on the form
behind the datagrid.

How can i get them on the datagrid?

Nov 16 '05 #2

P: n/a
Ignore it. It is only for updating web datagrids...
sorry!
"Telmo Sampaio" <ts******@gmail.com> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
I have not done this before, but I remeber seeing that you can add a control to a Datagrid cell by addin it to the Controls collection of the cell. You
are adding it to the Controls collection of the form now, just positioning
it at the same place as your cell.

Here is a related link used for updating values in a web datagrid:
http://msdn.microsoft.com/library/de...us/dv_vbcode/h tml/vbtskcodeupdatingitemsindatagridordatalistwebcontr olvisualbasic.asp

Telmo Sampaio
"Tolga" <to**********@hotmail.com> wrote in message
news:f6**************************@posting.google.c om...
How do insert a user control i have created into a datagrid cell.
Basically i am trying to create a column of my user controls. This is
what i have tried so far.
int i = 0;
while (i < dsSignIn1.Tables["Contacts"].Rows.Count)
{
SignatureControl.SignatureControl sig1 =
new SignatureControl.SignatureControl();
Point p1 = new

Point(dgSignIn.GetCellBounds(i,3).X,dgSignIn.GetCe llBounds(i,3).Y);//,dgSign In.GetCellBounds(i,0).Y);
MessageBox.Show(this,p1.ToString());
sig1.Location = p1;
this.Controls.Add(sig1);
i++;
}

I get the cooulmn of the user controls but they show up on the form
behind the datagrid.

How can i get them on the datagrid?


Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.