最近公司让我用c#.net做winform的程序,第一次做没什么经验,我想问一下,我能不能是实现,在选择下拉列表的同时就将对应的数据显示到面板上面(下拉列表的数据也是动态绑定的),如果能实现,应该用什么方法,谢谢各位前辈~~

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                //显示选中项
                MessageBox.Show(comboBox1.SelectedItem.ToString());
            }        private void Form1_Load(object sender, EventArgs e)
            {
                //清空所有项
                comboBox1.Items.Clear();            //添加项
                  comboBox1.Items.Add("a1");
                comboBox1.Items.Add("a2");
                comboBox1.Items.Add("a3");
            }
        }
    }
      

  2.   

    1.autopostback设为true
    2.在selectindexchanged事件中写绑定方法。
      

  3.   

    直接在selectindexchange事件内写绑定方法
      

  4.   

    在selectIndexChanged事件里写绑定数据的方法
      

  5.   

    selectIndexChanged时绑定数据,并显示的方法即可
      

  6.   

    ComboBox也是有DataSource属性的,再设一个DisplayMember和和ValueMember
      

  7.   

    SelectedIndexChange事件里面写
    SelectedValue就是你选择的值,你这个值传到画板上就行了
      

  8.   

    1.autopostback设为true
    2.在selectindexchanged事件中写绑定方法。
      

  9.   

    使用ComBoBox控件,设置属性:
    在SelectIndexChanged事件中写你要显示的数据,ComboBox当前数据为ComboBox.Text;
      

  10.   

    可以实现 在winform很容易实现、web稍微难实现一点