kumartyr

kumartyr

  • NA
  • 55
  • 28k

how to do autocomplete for date in textbox in required formt

Aug 13 2013 1:26 AM
i have a form in which am displaying data in datagridview from DB &  i also have a textbox in which am able to autocomplete strings of other columns and search in datagridview and get the matching data filtered and displayed in datagridview but not able to do that for date column

how to do autocomplete for date alone [not with time] in textbox in required format "dd-mm-yyyy" and fetch the matching date column to display in datagriview

i have tried the below code but it doesn't works

AutoCompleteStringCollection ACSCVV = new AutoCompleteStringCollection();
OLCMND3 = new OracleCommand("Select to_date(to_char(TODAYDATE, 'dd-mm-yyyy'),'dd-mm-yyyy HH:MI:SS') as TODAYDATE from TABLENAME order by NUMBER asc", CON);

                DR1 = OLCMND3.ExecuteReader();

                if (DR1.HasRows == true)
                {
                    while (DR1.Read())
                    {
                        ACSCVV.Add(DR1["TODAYDATE"].ToString());
                    }
                }
                else
                {
                    MessageBox.Show("No Data Present In The Database");
                }

                DR1.Close();

                TypeHereTextBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                TypeHereTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                TypeHereTextBox.AutoCompleteCustomSource = ACSCVV;


Answers (3)