I fill a ListBox From Database with the code below , and I want to search by a TextBox with AutoCompleteMode in the listBox.. How can I do it please?
public void refreshdata()
{
//DataRow dr;
SqlConnection cn = new SqlConnection(@"Server=.\SQLEXPRESS; DataBase=Gestion Cabinet; Integrated Security = true;");
cn.Open();
SqlCommand cmd = new SqlCommand("select * from Médicaments", cn);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
listBox1.Items.Add(ds.Tables[0].Rows[i][1]
+ " " + ","
+ ds.Tables[0].Rows[i][2]
+ " " + ","
+ ds.Tables[0].Rows[i][3]);
cn.Close();
}
请参阅: 在列表框中搜索希望对您有所帮助。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.