3个回答
展开全部
private void AddTextBoxs()
{
TableRow tr = new TableRow();
TableCell TCPartNo = new TableCell();
TableCell TCPartName = new TableCell();
TableCell TCQuantity = new TableCell();
TableCell TCOriginalSN = new TableCell();
TableCell TCNewSN = new TableCell();
TextBox TBPartNo = new TextBox();
TextBox TBPartName = new TextBox();
TextBox TBQuantity = new TextBox();
TextBox TBOriginalSN = new TextBox();
TextBox TBNewSN = new TextBox();
TBPartNo.ID = "TBPartNo" + TableNewRow.Rows.Count;
TBPartName.ID = "TBPartName" + TableNewRow.Rows.Count;
TBQuantity.ID = "TBQuantity" + TableNewRow.Rows.Count;
TBOriginalSN.ID = "TBOriginalSN" + TableNewRow.Rows.Count;
TBNewSN.ID = "TBNewSN" + TableNewRow.Rows.Count;
TBPartNo.Width = 119;
TBPartName.Width = 170;
TBQuantity.Width = 70;
TBOriginalSN.Width = 120;
TBNewSN.Width = 120;
TBPartNo.MaxLength = 50;
TBPartName.MaxLength = 50;
TBQuantity.MaxLength = 4;
TBOriginalSN.MaxLength = 50;
TBNewSN.MaxLength = 50;
TCPartNo.Controls.Add(TBPartNo);
TCPartName.Controls.Add(TBPartName);
TCQuantity.Controls.Add(TBQuantity);
TCOriginalSN.Controls.Add(TBOriginalSN);
TCNewSN.Controls.Add(TBNewSN);
tr.Cells.Add(TCPartNo);
tr.Cells.Add(TCPartName);
tr.Cells.Add(TCQuantity);
tr.Cells.Add(TCOriginalSN);
tr.Cells.Add(TCNewSN);
TableNewRow.Rows.Add(tr);
}
通过测试,我做的网站上使用动态添加,我添加的是TextBox
{
TableRow tr = new TableRow();
TableCell TCPartNo = new TableCell();
TableCell TCPartName = new TableCell();
TableCell TCQuantity = new TableCell();
TableCell TCOriginalSN = new TableCell();
TableCell TCNewSN = new TableCell();
TextBox TBPartNo = new TextBox();
TextBox TBPartName = new TextBox();
TextBox TBQuantity = new TextBox();
TextBox TBOriginalSN = new TextBox();
TextBox TBNewSN = new TextBox();
TBPartNo.ID = "TBPartNo" + TableNewRow.Rows.Count;
TBPartName.ID = "TBPartName" + TableNewRow.Rows.Count;
TBQuantity.ID = "TBQuantity" + TableNewRow.Rows.Count;
TBOriginalSN.ID = "TBOriginalSN" + TableNewRow.Rows.Count;
TBNewSN.ID = "TBNewSN" + TableNewRow.Rows.Count;
TBPartNo.Width = 119;
TBPartName.Width = 170;
TBQuantity.Width = 70;
TBOriginalSN.Width = 120;
TBNewSN.Width = 120;
TBPartNo.MaxLength = 50;
TBPartName.MaxLength = 50;
TBQuantity.MaxLength = 4;
TBOriginalSN.MaxLength = 50;
TBNewSN.MaxLength = 50;
TCPartNo.Controls.Add(TBPartNo);
TCPartName.Controls.Add(TBPartName);
TCQuantity.Controls.Add(TBQuantity);
TCOriginalSN.Controls.Add(TBOriginalSN);
TCNewSN.Controls.Add(TBNewSN);
tr.Cells.Add(TCPartNo);
tr.Cells.Add(TCPartName);
tr.Cells.Add(TCQuantity);
tr.Cells.Add(TCOriginalSN);
tr.Cells.Add(TCNewSN);
TableNewRow.Rows.Add(tr);
}
通过测试,我做的网站上使用动态添加,我添加的是TextBox
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
代码里
Label lb1=new Label();
这就生成了一个lb1,把lb1这个对象加到父容器上就行了
//本人没有试过此方法,你可以试一下
Label lb1=new Label();
这就生成了一个lb1,把lb1这个对象加到父容器上就行了
//本人没有试过此方法,你可以试一下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Label lab = new Label();
lab.Text = "&Save";
lab.Size = new Size(100,30);
lab.Location = new Point(0,0);
this.Controls.Add(lab);
lab.Text = "&Save";
lab.Size = new Size(100,30);
lab.Location = new Point(0,0);
this.Controls.Add(lab);
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询