C# DataGridView & Scrollbar position setting problem
I'll start off with what i'm trying to do:
i want to search my data programmatically and then jump to the row in the datagrid.
My data will almost allways go out of the datagrids bounds so if the found result is not on screen at the time i want to 'scroll' to the result.
sounds simple enough right?
Some things i've tried to get the datagrid to do what i want:
-setting the autoscrollposition property, i've tried setting it after finding the result and tried setting it in the paint loop (which was an advice found while looking for an awnser on the net)
neither had any visible effect, the property changed but didn't show in the controll after invalidation & painting. so i discarded this avenue as the incorrect appoach
-Getting the VScrollBar from the datagridview.controls list and then setting its value directly to the position on which i want it to be.
now this actually had some effect: the scrollbars handle appeared on the correct position, but the datagrid did not scroll along. now if i touch/drag the handle of the scrollbar then it does update the position and i'm near my result (depending on howfar i dragged the handle)
so the problem here seems to be that the datagrid doesn't seem to pick up the change until i actually use a physical mouseinput on the scrollbar
i'm currently trying to invoke the scrollbars mouseclick/drag whatever but so far i havn't made any process in that area yet.
Now my question is:
-does anybody have any idea of how to get the datagrid to pick up the change, or does anybody have another method of setting the scrolloffset which actually shows.
basically i'm running into walls when i'm looking through the internet/msdn and i'm running out of ideas so any help would be welcome.
edit: had a linebreak problem using BR's now, this should make it legible