小编Geh*_*man的帖子

'TextBox'不包含'ID'的定义

我有以下代码在每个按钮单击上创建一个文本框:

private void AddNewTimer_Click(object sender, EventArgs e)
{
    int timerCount = 0;
    int boxY = 0;
    if (timerCount <= 6)
    {
        timerCount++;
        TextBox txt = new TextBox();
        txt.ID = "timer" + timerCount++;
        txt.Text = Convert.ToString(timerCount);
        txt.Name = Convert.ToString(timerCount);
        txt.Width = 63;
        txt.Location = new Point(0, boxY);
        TimerContainer.Controls.Add(txt);
        boxY = boxY + 25;
    }
}
Run Code Online (Sandbox Code Playgroud)

txt.ID = timerCount++;给我'TextBox' does not contain a definition for 'ID',虽然在回答说明这个问题,在这个页面.

c# winforms

0
推荐指数
1
解决办法
133
查看次数

标签 统计

c# ×1

winforms ×1