在运行时,在页面里,能不能通过listbox输入数据??

解决方案 »

  1.   

    是不是这个意思,就是在运行的时候,假如有一个button键,然后把输入的数据,插入到listbox当中,如果是这样的话是可以的
      

  2.   

    文本框,加个按钮可以放在LISTBOX里!!
      

  3.   

    以下是我做的一个范例代码,仅供参考:public class WebForm2 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.TextBox TextBox1;
    protected System.Web.UI.WebControls.ListBox ListBox1;
    protected System.Web.UI.WebControls.Button Button1;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void Button1_Click(object sender, System.EventArgs e)
    {
    this.ListBox1.Items.Add(this.TextBox1.Text); }
    }
      

  4.   

    主要是设置按钮的事件:
    private void Button1_Click(object sender, System.EventArgs e)
    {
    this.ListBox1.Items.Add(this.TextBox1.Text); }
      

  5.   

    private void Button1_Click(object sender, System.EventArgs e)
    {
    this.ListBox1.Items.Add(this.TextBox1.Text); }正解
      

  6.   

    也主是说,listbox在运行时,不能象 文本框那样,直接的输入数据呢,??