c# - change listbox position according to row bound -
i have grid view control 5 columns in windows app , list box. when type in 3rd cell, list box shown items. list box position below first row(third cell). want whenever new row bind grid view control, want list box shown below current cell.how can that?
code:
public partial class form1 : form { sqlconnection con = new sqlconnection(); string sqlquery = ""; bool text = false; public form1() { initializecomponent(); } control txtchanged; private void dgvpos_editingcontrolshowing_1(object sender, datagridvieweditingcontrolshowingeventargs e) { e.control.textchanged += new eventhandler(itemtxtbox_textchanged); txtchanged = e.control; txtchanged.textchanged += itemtxtbox_textchanged; } void itemtxtbox_textchanged(object sender, eventargs e) { if (text == false) { if (txtchanged.text != string.empty) { getproductname(); } } } private void getproductname() { sqlquery = "select productname products productname n'" + txtchanged.text + "%'"; sqldataadapter sadapter = new sqldataadapter(sqlquery, con); datatable datatable = new datatable(); sadapter.fill(datatable); lbxproductname.items.clear(); int count = datatable.rows.count; if (count > 0) { lbxproductname.visible = true; (int = 0; < count; i++) { lbxproductname.items.add(datatable.rows[i][0]); } } }
wiki
Comments
Post a Comment