我在WinForm程序里放了一个combobox控件,我选择了一个选项如何返回两个值那?我combobox里面绑定了数据库的表明,我想显示中文字,然后选择后我想得到显示的中文字 然后还有实际存储的表明。请问我得这么做 (不能做重复的数据库操作)谢谢了 谢谢

解决方案 »

  1.   

    class MyComboBox : ComboBox
        {
            System.Collections.Hashtable hash = new System.Collections.Hashtable() ;        public void Add(string value, string name)
            {
                hash.Add(name, value);
                base.Items.Add(name);
            }
            public string GetValue()
            {
                if (base.SelectedIndex == -1) return string.Empty;
                if (hash.Contains(base.SelectedItem))
                {                return hash[base.SelectedItem].ToString();
                }            return string.Empty;
            }
           
        }
    这里只是一种编程思想,还有很多方法