简单那做一下的话,可以用datatable.computer来做。
解决方案 »
- 向.net高手求救:C# 实现DSA签名
- webbrowser模拟点击div 没id 没name的button
- 求助!C#的小问题!
- C#代码中的方括号是做什么用的?
- 求字符串子串时的错误?
- (100分,帮顶有分)使用API函数GetTextExtentPoint量出字符串长度?非MeasureString方法
- 按Enter键执行程序
- 散分了!为什么 DataGridTableStyle ccc = new DataGridTableStyle();返回空对象
- 为什么无法在C#.net中使用Microsoft Communications Control ,Version 6.0 ,系统提示我“您没有使用此ActiveX控件的许可证。
- 问一个datagrid的问题
- 访问不了自定义的类库
- 【求助】怎么把Silverlight的值传给wpf网页..? 不用cookie... 并一些Silverlight问题
还有就是我的vs2010 工具箱中有的部分控件是灰色的,不能使用!!! 我也急死了!!
看下图、、、、、、、、
没图
自动补全
private void Form2_Load(object sender, EventArgs e)
{
AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
DataSet ds=getList();
foreach (DataRow drv in ds.Tables[0].Rows)
{
for(int i=0;i<ds.Tables[0].Columns.Count;i++)
{
acsc.Add(drv[0].ToString());
} } acsc.Add("asdjhkj");
acsc.Add("2412312");
acsc.Add("asdaasdkj");
acsc.Add("78fsdfhj");
acsc.Add("0if0sdfn");
acsc.Add("67dasgdh");
acsc.Add("0dasdjasd");
acsc.Add("23ashdb");
this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
this.textBox1.AutoCompleteCustomSource = acsc;
} public DataSet getList()
{
DataSet ds = new DataSet();
string str = "server=(local);integrated security=SSPI;database=test_t";
SqlConnection conn = new SqlConnection(str);
conn.Open();
string sql = "SELECT name From tb_userInfo";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
return ds;
}
}
还有就是打个比方:
数据库中有44MDCSA123456,当我在textbox中输入sa123456时,能把数据库中的
44MDCSA123456带出来! 如何实现呢?
各位大仙,帮帮小鸟