views:

33

answers:

0

Hi, back with a new questions.

this time is regarding Data Grids,

At the moment i currently have an unbound datagridview control which i populate from a mysql statement, i can then search and repopulate the control from a text box using an on keydown event, which basically takes the indexof the search box and checks it against the returned values from the sql statement if the indexof is > than 0 add that result to the datagrid control.

this works well and i am confortable with it, however there is an issue then when the data grid is loaded and populated (when the form loads) the first row is selected(highlighted) and due to the nature in which i am using this control it really needs not to be.

i have tried things like mydatagrid.selectedrows[0] = false , and mydatagrid.rows[0].selected = false etc but they dont make any difference.

after a bit of googling i found that other ppl had made it work but they all reference when they had bound the datagrid to a data source. and then fired the finished_binding event and then set the selected row to false.

so i then looked at binding my datagrids to my database tables (mysql) which is fine ish not a problem. the problem there in lies how to do the search function.

so the Question is this

If i have a datagrid unbound and fill it myself, can i make it have no selected row until the user has actually clicked on a row(btw it set to select full row and multiselect=false)? or how can i have a textbox which will search and filter the items shown in the datagrid?

thanks for your time in reading this

Alan