I want the horizontal scrollbar location to be altered during runtime.

I have read msdn, and the scroolbar property of the datagrid is readonly, so
there seems to be no apparent way to simply set it.

My next guess was to override the HorizScrollbar property and play wiht the
datagrid controls collection... but I was unsuccessful

How should I do it?? Wha I really need is a public property of the datagrid
that allow me to set and get the horizontal scrollbar location at runtime.

kind regards
Henrik

Re: How do I set the of the datagrid horizontal scroolbar position? by Ken

Ken
Wed Oct 20 07:05:54 CDT 2004

Hi,

For Each ctrl As Control In DataGrid1.Controls

If TypeOf ctrl Is HScrollBar Then

With DirectCast(ctrl, HScrollBar)

Trace.WriteLine(String.Format("Max {0} Min {1} Value {2}", .Maximum,
.Minimum, .Value))

End With

End If

Next



Ken

--------------------------------------

"Henrik Nordgren" <HenrikNordgren@discussions.microsoft.com> wrote in
message news:DB3B5985-CB83-4B46-9D60-B023E9B2F9A1@microsoft.com...
I want the horizontal scrollbar location to be altered during runtime.

I have read msdn, and the scroolbar property of the datagrid is readonly, so
there seems to be no apparent way to simply set it.

My next guess was to override the HorizScrollbar property and play wiht the
datagrid controls collection... but I was unsuccessful

How should I do it?? Wha I really need is a public property of the datagrid
that allow me to set and get the horizontal scrollbar location at runtime.

kind regards
Henrik



Re: How do I set the of the datagrid horizontal scroolbar positio by HenrikNordgren

HenrikNordgren
Thu Oct 21 03:29:06 CDT 2004

Hi!

Yes that I already know (how t get the Hscrollbar object). The problem I
have is how to programatically make it slide to a certain position (value
property).
For example when I do this:

DirectCast(ctrl, HScrollBar).Value = DirectCast(ctrl, HScrollBar).Value + 10

the slider is indeed moving, but not the datagrid content... Do I miss to
make some kind of refresh, to bind the position of the content of the grid to
the hscrollbar position?

kind regards
Henrik


"Ken Tucker [MVP]" wrote:

> Hi,
>
> For Each ctrl As Control In DataGrid1.Controls
>
> If TypeOf ctrl Is HScrollBar Then
>
> With DirectCast(ctrl, HScrollBar)
>
> Trace.WriteLine(String.Format("Max {0} Min {1} Value {2}", .Maximum,
> ..Minimum, .Value))
>
> End With
>
> End If
>
> Next
>
>
>
> Ken
>
> --------------------------------------
>
> "Henrik Nordgren" <HenrikNordgren@discussions.microsoft.com> wrote in
> message news:DB3B5985-CB83-4B46-9D60-B023E9B2F9A1@microsoft.com...
> I want the horizontal scrollbar location to be altered during runtime.
>
> I have read msdn, and the scroolbar property of the datagrid is readonly, so
> there seems to be no apparent way to simply set it.
>
> My next guess was to override the HorizScrollbar property and play wiht the
> datagrid controls collection... but I was unsuccessful
>
> How should I do it?? Wha I really need is a public property of the datagrid
> that allow me to set and get the horizontal scrollbar location at runtime.
>
> kind regards
> Henrik
>
>
>