database - datagridview to textbox binding data -


when program executed, datagridview populate data , textboxes(example stocknumber,description) , when typed words in search textbox ,the datagridview filters matching words.when clicked item in datagridview textboxes not changed didnt show information...

what solution problem..i need display information in textboxes when clicked item in datagridview..

private sub txtreg_delsrch_textchanged(byval sender system.object, byval e system.eventargs) handles txtreg_delsrch.textchanged      dim con oledbconnection = new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=c:\users\sony\documents\visual studio 2008\projects\inventory\iteminventory.mdb")     dim cmd oledbcommand = new oledbcommand("select stockno,item,description,reference,quantity,unit supplies_regular description '%" & txtreg_delsrch.text & "%'", con)     con.open()     dim myda oledbdataadapter = new oledbdataadapter(cmd)     dim mydataset dataset = new dataset()     myda.fill(mydataset, "mytable")     supplies_regulardatagridview1.datasource = mydataset.tables("mytable").defaultview  end sub 

perhaps use bindingsource:

dim binding = new bindingsource()      { .datasource = mydataset.tables("mytable") } supplies_regulardatagridview1.datasource = binding stocknumber_textbox1.databindings.add("text", binding, "stockno") 

last line binds object's stockno property textbox.text.


Comments