Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Autocomplete Combobox with ComboBoxStyle.Simple

$
0
0

I am making a WinForm in C#3.5 and am trying to create a combo box that will let the user type in their input 

my code :

            cboCustomer.DropDownStyle = ComboBoxStyle.Simple;

            DataTable dt = Globale.ReturnTable("SELECT Id, [NAME] FROM ACTM WHERE (DBCR = 'D') ORDER BY [NAME]");

            cboCustomer.DataSource = dt;
            cboCustomer.ValueMember = "Id";
            cboCustomer.DisplayMember = "Name";
            cboCustomer.AutoCompleteMode = AutoCompleteMode.Suggest;
            cboCustomer.AutoCompleteSource = AutoCompleteSource.ListItems;
            cboCustomer.SelectedIndex = -1;

It seems that the "suggest" part of the autocomplete does not work with combo boxes that have a Simple DropDownStyle. If you type first letter of one of the items and then click on it, the text in the combo box just gets cleared. This is only a problem with the Simple combo boxes, though.


i want use ComboBoxStyle.Simple and second when user  type any think he  will select  name sagest autocomplet in combox list  and he will select name and  i want to know  it's value member i.e id.

my application is i need id from name from ComboBoxStyle.Simple  not  not dropdowlist

please help me


Best Regard Naweez



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>