Home All Groups Group Topic Archive Search About

How to auto scroll a datagrid?

Author
26 Nov 2007 2:37 PM
Soulless
Hi,

I have a datagrid (rather a dataset I guess) that I update with
addStatusRow ( ... ).   It basically is a Status that adds lines as
something occurs in my thread.   As lines are entered, when it gets to
the bottom of the grid, I would like it to automatically scroll, so
the user does not need to use the scroll bar.

Is this easily done?

I have the code:

dsStatus1.Status.AddStatusRow(ibrFixSession.Status,
System.DateTime.Now.ToLongDateString() + " " +
System.DateTime.Now.ToLongTimeString());

            AddToLog(ibrFixSession.Status);

            dataGridSessionFix.CurrentRowIndex =
dsStatus1.Status.Rows.Count;

I was hoping that the last line will scroll my datagrid to the last
record, but does not work.   The dsStatus1 is bound to the grid.   It
is the dsStatus1 that has the rows added.   Any ideas if or how I
could get this to work?

Thanks!

Author
26 Nov 2007 10:43 PM
Kerem Gümrükcü
Hi Soulless (is this your real name?),

if something has a scrollbar, then you can send a
Message to it to make it scroll. See here Messages
and Notifications section for more information. Once
again: If someting has a scrollbar, it can be scrolled
with the windows api and in our case with pinvoking
of the native windows functions like SendMessage
and the Scrollbar Functions:

[Scroll Bar]
http://msdn2.microsoft.com/en-us/library/bb787529.aspx

Hope this helps,...

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Author
28 Nov 2007 3:44 PM
Soulless
Show quote
On Nov 26, 4:43 pm, "Kerem Gümrükcü" <kareem***@hotmail.com> wrote:
> Hi Soulless (is this your real name?),
>
> if something has a scrollbar, then you can send a
> Message to it to make it scroll. See here Messages
> and Notifications section for more information. Once
> again: If someting has a scrollbar, it can be scrolled
> with the windows api and in our case with pinvoking
> of the native windows functions like SendMessage
> and the Scrollbar Functions:
>
> [Scroll Bar]http://msdn2.microsoft.com/en-us/library/bb787529.aspx
>
> Hope this helps,...
>
> Regards
>
> Kerem
>
> --
> -----------------------
> Beste Grüsse / Best regards / Votre bien devoue
> Kerem Gümrükcü
> Microsoft Live Space:http://kerem-g.spaces.live.com/
> Latest Open-Source Projects:http://entwicklung.junetz.de
> -----------------------
> "This reply is provided as is, without warranty express or implied."

Hey, Thanks!!!
Author
28 Nov 2007 4:06 PM
Kerem Gümrükcü
Dude, you are welcome,...
Sign my guestbook if you like, i need entries, its new :-)

http://entwicklung.junetz.de/guestbook


Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

AddThis Social Bookmark Button