Scrolling DataGrid (.Net CF)

this is what i found on the net on how to scroll a data grid
//Get a reference to the scroll bars in the data grid
VScrollBar vsb = (VScrollBar)grd.GetType().GetField("m_sbVert", BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(grd);

HScrollBar hsb = (HScrollBar)grd.GetType().GetField("m_sbHorz", BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(grd);


hsb.Value=hsb.Maximum ;
vsb.Value=vsb.Maximum ;

if anyone knows how to do the same for a ListView please let me know

Comments

Roland Beuker said…
Hello Mosalem,

The code:

//Get a reference to the scroll bars in the data grid
VScrollBar vsb = (VScrollBar)mScanDataGrid.GetType().GetField("m_sbVert", BindingFlags.NonPublicBindingFlags.GetFieldBindingFlags.Instance).GetValue(mScanDataGrid);

Is not working on .Net 2.0 (CF) :-( NonPublicBindingFlags is not a member of BindingFlags anymore. Do you know had to get the vertical scroll bar now?
Roland Beuker said…
Or do you have another method for scrolling to the last row of a datagrid (client framework)?
Mosallem said…
Hello Roland,
the code above is working on .Net V 2.0, it just had some HTML special characters that didn't appear, i fixed it you can see it aboe
.net grid said…
Thanks for such a valuable information on .net grid.with the help of this we can easily scroll the DataGrid and this has quicken our work.I got many important tips and ideas today from your blog. Thanks.

Popular posts from this blog

Documentum DQL Query Custom Data Extension For SQL Server Reporting Services

Silverlight 4.0 Tutorial (12 of N): Collecting Attendees Feedback using Windows Phone 7

Using taco to create Ionic projects for the Windows platform