sayeed BAGBAN

sayeed BAGBAN

  • NA
  • 34
  • 8.3k

Autocomplete textbox in Mdi child form c#

Oct 9 2013 7:21 AM
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)