2
Answers

Autocomplete textbox in Mdi child form c#

sayeed BAGBAN

sayeed BAGBAN

11y
1.1k
1
Hi everyone,

Can any one please let me know how the Auto complete works in Mdi child form ?

I have created the simple windows from in that the below code is working fine but the same code if i implement it to MDI Child form then the same suggestion is not working?

using (OleDbConnection con = new OleDbConnection(ConString))
                {
                    OleDbCommand cmd = new OleDbCommand("Select ConsigneeName From tblConsignee", con);
                    OleDbDataReader dReader;
                    SqlConnection conn = new SqlConnection();
                    con.ConnectionString = ConString;
                    con.Open();
                    dReader = cmd.ExecuteReader();

                    if (dReader.HasRows == true)
                    {
                        while (dReader.Read())
                            namesCollection.Add(dReader["ConsigneeName"].ToString());
                    }
                    else
                    {

                    }
                    dReader.Close();
                    txtConsigneeName.AutoCompleteCustomSource = namesCollection;
                    txtConsigneeName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                    txtConsigneeName.AutoCompleteSource = AutoCompleteSource.CustomSource;
                }
Answers (2)