[英]How to Insert UserControl TextBox to DataGridView in C#?
In Sql Server 2005, In Form Load I write this Code. 在Sql Server 2005中,在Form Load中,我编写此代码。 txtPrprCase is a UserControl and validates First Character to Capital.
txtPrprCase是一个UserControl,可将“首字符”验证为大写。 How to i add this Control to DataGridView.
我如何将此控件添加到DataGridView。 I try the Following Code.
我尝试以下代码。 But it does not Work.
但这不起作用。
ciscontrols.txtPrprCase txt = new ciscontrols.txtPrprCase();
txt.Name = "Customer Name";
this.dataGridView2.RowCount = 1;
foreach (DataGridViewRow row in dataGridView2.Rows)
{
row.Cells[0].Value = txt;
}
and the following code works the validation 和下面的代码验证工作
ciscontrols.txtPrprCase txt = new ciscontrols.txtPrprCase();
this.dataGridView2.Rows.add(txt);
it works but it does not contain column header and row header... 它可以工作,但不包含列标题和行标题...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.