日期:2014-05-18 浏览次数:20847 次
public void btnQuery_Click(object sender,EventArgs e) { ... string s1 = this.DropDownList1.SelectedItem.Text.Trim(); string s2 = this.DropDownList2.SelectedItem.Text.Trim(); ... }
------解决方案--------------------
WinForm的ComboBox啊,本来还以为是DropDownList呢
private void button1_Click(object sender, EventArgs e) { string s1 = this.comboBox1.SelectedValue; // this.comboBox1.SelectedText; string s2 = this.comboBox2.SelectedValue; //this.comboBox2.SelectedText; }
------解决方案--------------------
string s1 = this.comboBox1.SelectedValue.ToString();
string s2 = this.comboBox2.SelectedText.Trim();