如何获取下拉列表中的选项 怎么在点击查询后让程序获取到这两个下拉列表中的选项 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用循环读取combobox.Items的所有元素就可以, 在点击按钮的事件代码中添加如下两行代码即可。public void btnQuery_Click(object sender,EventArgs e){ ... string s1 = this.DropDownList1.SelectedItem.Text.Trim(); string s2 = this.DropDownList2.SelectedItem.Text.Trim(); ...} 错误 1 “lettey.Form1”不包含“DropDownList1”的定义,并且找不到可接受类型为“lettey.Form1”的第一个参数的扩展方法“DropDownList1”(是否缺少 using 指令或程序集引用?)出现这个错误时怎么回事 缺少引用? using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace lettey{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { // TODO: 这行代码将数据加载到表“db1DataSet1.bind_number”中。您可以根据需要移动或移除它。 this.bind_numberTableAdapter.Fill(this.db1DataSet1.bind_number); // TODO: 这行代码将数据加载到表“db1DataSet.bind_type”中。您可以根据需要移动或移除它。 this.bind_typeTableAdapter.Fill(this.db1DataSet.bind_type); } private void button1_Click(object sender, EventArgs e) { string s1 = this.comboBox1.SelectedItem.Text.Trim(); string s2 = this.comboBox2.SelectedItem.Text.Trim(); } }}这是我的代码 问题如下错误 1 “object”不包含“Text”的定义,并且找不到可接受类型为“object”的第一个参数的扩展方法“Text”(是否缺少 using 指令或程序集引用?)谁能帮我看看 谢谢 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(); 前台调用后台 高手请看问题:BindingSource ,ErrorProvider 使用的问题 求一个解决思路(路过送分) 求求高手帮我把下面VC++代码用C#语法写出来好么!! 如何保存曲线图为图片,并且可以打印? window窗体之间实现的代码 高手帮忙 C#中的类型转换问题,谢谢!!!! 如何开发一个打印控件,在Web中可以直接调用的? C#的代码编辑和风格 -- 实在是找不出它的优点! 关于TreeView的问题,火急!!!! 从数据库读取两张表,里面的记录有各自的起止时间,统计一张表中时间在另一张时间内的总和 非托管资源如何理解?
public void btnQuery_Click(object sender,EventArgs e)
{
...
string s1 = this.DropDownList1.SelectedItem.Text.Trim();
string s2 = this.DropDownList2.SelectedItem.Text.Trim();
...
}
出现这个错误时怎么回事 缺少引用?
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace lettey
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void label1_Click(object sender, EventArgs e)
{ } private void Form1_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“db1DataSet1.bind_number”中。您可以根据需要移动或移除它。
this.bind_numberTableAdapter.Fill(this.db1DataSet1.bind_number);
// TODO: 这行代码将数据加载到表“db1DataSet.bind_type”中。您可以根据需要移动或移除它。
this.bind_typeTableAdapter.Fill(this.db1DataSet.bind_type); } private void button1_Click(object sender, EventArgs e)
{
string s1 = this.comboBox1.SelectedItem.Text.Trim();
string s2 = this.comboBox2.SelectedItem.Text.Trim();
}
}
}这是我的代码 问题如下
错误 1 “object”不包含“Text”的定义,并且找不到可接受类型为“object”的第一个参数的扩展方法“Text”(是否缺少 using 指令或程序集引用?)
谁能帮我看看 谢谢
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 s2 = this.comboBox2.SelectedText.Trim();