Friday, February 5, 2016

Create auto complete drop down list (Windows forms)

[code] List<DataRow> companyList = new List<DataRow>(); DataTable dt = loadEMEIsService.getLocationDetails(); if (dt.Rows.Count > 0) { DataRow dr = dt.NewRow(); dr["Location"] = "---Select---"; dr["ListId"] = -1; dt.Rows.InsertAt(dr, 0); cmbFromLocation.DataSource = dt; cmbFromLocation.DisplayMember = "Location"; cmbFromLocation.ValueMember = "ListId"; this.cmbFromLocation.AutoCompleteSource = AutoCompleteSource.ListItems; this.cmbFromLocation.AutoCompleteMode = AutoCompleteMode.SuggestAppend; } [/code]

No comments:

Post a Comment