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
//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
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?
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