Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# WPF ComboBox AutoComplete

C# WPF ComboBox AutoComplete

Scheduled Pinned Locked Moved C#
4 Posts 2 Posters 106 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Karam_Ibrahim
    wrote last edited by
    #1

    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 Fill

    Window:
    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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kevin Marois
      wrote last edited by
      #2

      https://stackoverflow.com/questions/27963022/autocomplete-combobox-for-wpf

      K 1 Reply Last reply
      0
      • K Kevin Marois

        https://stackoverflow.com/questions/27963022/autocomplete-combobox-for-wpf

        K Offline
        K Offline
        Karam_Ibrahim
        wrote last edited by
        #3

        @Kevin-Marois Thanks for your help, but the code mentioned in that link not working correctly

        J 1 Reply Last reply
        0
        • K Karam_Ibrahim

          @Kevin-Marois Thanks for your help, but the code mentioned in that link not working correctly

          J Offline
          J Offline
          jeron1
          wrote last edited by
          #4

          @Karam_Ibrahim Perhaps if you described the problem in more detail you would get more responses, 'not working correctly' is bit vague.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups