Groups | Blog | Home
all groups > vb.net data > december 2004 >

vb.net data : reading and setting location for horizontal srcoll bar



ZR
12/28/2004 5:55:03 PM
is there a way to control (get and set) the position of a Datagrid's,
horizontal scrollbar?

I am linking the datagrid to a very large table (hundreds of thousands of
records)
i cannot connect it to all the data at once since it would require lots and
lots of memory.
so i break up the table into sections, and i refresh the data as the user
scroll to provide the next section.
but when grid is refreshed the horizontal scrollbar losses its position.

Thanks in advance for you help.
zr

Grant Smith
1/11/2005 1:51:19 PM
You need to create your own DataGrid class to inherit from the
DataGrid. This way you can access GridHScrolled and GridVScrolled
methods which are protected otherwise. Using those two methods will
let you scroll vertically or horizontally

Example:
(Me refers to the new datagrid class object that I created)
Me.GridHScrolled(Me, New
ScrollEventArgs(ScrollEventType.LargeIncrement, intNewPos))

To get the positions:
Me.VertScrollBar.Value

Me.HorizScrollBar.Value

HTH

Grant
AddThis Social Bookmark Button