当前位置:编程学习 > C#/ASP.NET >>

另外一个窗口弹出来的问题??

   一个listBox控件  点击listBox中的选项(考试的科目比方说数学) 按一下确定会弹出另外一个页面 应怎样设计 请各位高手 --------------------编程问答-------------------- listBox1_SelectedIndexChanged事件

   --------------------编程问答-------------------- 在点击确定的时候根据listbox的选中状态,让他弹出窗体就行了。 --------------------编程问答-------------------- 利用listBox1_SelectedIndexChanged事件来实现,然后用switch case根据你选择的值(listBox1.selectValue)来弹出那个页面! --------------------编程问答-------------------- 利用listBox1_SelectedIndexChanged事件来实现,然后用switch case根据你选择的值(listBox1.selectValue)来弹出那个页面! --------------------编程问答--------------------
引用 3 楼 jony07 的回复:
利用listBox1_SelectedIndexChanged事件来实现,然后用switch case根据你选择的值(listBox1.selectValue)来弹出那个页面!

UP --------------------编程问答--------------------   直接用menu空间就可以了 --------------------编程问答-------------------- 这种问题自己在百度上多查查资料,很简单的。
public Form2()
{
    InitializeComponent();
    this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    //非模态对话框
    Form1 fm = new Form1();
    fm.Show(this);
    //模态对话框
    Form1 fm = new Form1();
    fm.ShowDialog(this);
}
--------------------编程问答--------------------

public Form2()
{
    InitializeComponent();
    this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
            if (this.listBox1.SelectedItems.Count != 0)
            {
                Form1 fm = new Form1();
                fm.ShowDialog(this);
            }
}
--------------------编程问答--------------------

        private void btnSure_Click(object sender, EventArgs e)
        {
            if (this.listBox1.SelectedItems.Count > 0)
            {
                string s = this.listBox1.SelectedItem.ToString();
                Form1 f1 = new Form1(s);
                f1.Show();
            }
            else
            {
                MessageBox.Show("您尚未选中数据");
            }
        }
--------------------编程问答-------------------- public Form2()
{
    InitializeComponent();
    this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
  Form1 fm = new Form1();
    fm.Show(this);
    //模态对话框
    Form1 fm = new Form1();
    fm.ShowDialog(this);
}
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,