C# WPF ComboBox AutoComplete
-
Hi guys, Hope you are doing well.
I really need you guys. I have data brought from SQL Server to ComboBox. I have this code:
Class:
#region Fill
public static DataTable FillDataTable(string SelectTable)
{
DataAccess.DataBaseOpen();
Variables.AppSqlCommand = Variables.AppSqlConnection.CreateCommand();
Variables.AppSqlCommand.CommandType = CommandType.Text;
Variables.AppSqlCommand.CommandText = SelectTable;
DataAccess.AppExecuteNonQuery();
Variables.AppSqlDataAdapter = new SqlDataAdapter(Variables.AppSqlCommand);
Variables.AppDataTable = new DataTable();
Variables.AppSqlDataAdapter.Fill(Variables.AppDataTable);
return Variables.AppDataTable;
}public static void FillComboBox(ComboBox ComboBox, string Stored_Procedure)
{
FillDataTable(Stored_Procedure);
ComboBox.Items.Clear();
foreach (DataRow DataRow in Variables.AppDataTable.Rows)
if (!ComboBox.Items.Contains(DataRow["ColumnData"].ToString()))
ComboBox.Items.Add(DataRow["ColumnData"].ToString());
}
#endregion FillWindow:
FillGetUpdateData.FillComboBox(this.txtUsername, "SELECT Name AS ColumnData FROM TBL_ID ORDER BY Name");This is a call function in class.
However, I need when the user enters the character for the comboBox to filter or drop down the words that start with that character.
-
@Kevin-Marois Thanks for your help, but the code mentioned in that link not working correctly
-
@Kevin-Marois Thanks for your help, but the code mentioned in that link not working correctly
@Karam_Ibrahim Perhaps if you described the problem in more detail you would get more responses, 'not working correctly' is bit vague.