Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search Combo Box like Google Search

I am making a Windows Form in that I have A combo box, Into which i have loaded some 'Invoice Numbers', from SQL server 2010. I want to Display Invoice Numbers as the User types into the Combo box. For eg if User types '100' then the Invoice Numbers Starting with '100' should be displayed in the dropdown.

Please Help, Thanks in Advance...

like image 384
Sam Avatar asked Apr 08 '13 12:04

Sam


1 Answers

    DataTable temp;
    DataTable bank;
    private void Form1_Load(object sender, EventArgs e)
    {
        comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
        comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;

        temp = DbRdRw.SqlDbRead("Select * from BankMaster", "BankMaster");

        DataView dtview = new DataView(temp);
        dtview.Sort = "BankName DESC";
        bank = dtview.ToTable();

        comboBox1.DataSource = bank;
        comboBox1.ValueMember = "BankName";
        comboBox1.DisplayMember = "BankName";
    }
like image 195
Sam Avatar answered Oct 06 '22 22:10

Sam