求助,程序调试
using System;using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
int textNum;
int btnNum;
textNum = Convert.ToInt32(this.TextBox1.Text);
btnNum = Convert.ToInt32(this.TextBox2.Text);
for (int i=0;i<textNum;i++)
{
this.Panel1.Controls.Add(new TextBox());
}
for (int j = 0; j <btnNum; j++)
{
this.Panel1.Controls.Add(new Button());
}
}
}
为什么这句textNum = Convert.ToInt32(this.TextBox1.Text);老是说:输入字符串的格式不正确。
它和这句是一样的btnNum = Convert.ToInt32(this.TextBox2.Text);,为什么会出现这样的结果?