Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Autoscroll Datagrid?

18 views
Skip to first unread message

Justin Emlay

unread,
Jun 29, 2004, 4:33:58 PM6/29/04
to
Since I cant find any scroll properties, does anyone have a function that
will make a datagrid act like it's autoscrolling? I want a user to always
be able to see the record they just added.

Any ideas would be great!

Thanks,
Justin


ClayB [Syncfusion]

unread,
Jun 29, 2004, 4:49:59 PM6/29/04
to
George Shepherd's Windows Forms FAQ contains an entry entitled:

How do I programmatically scroll the datagrid to a particular row?

Check it out at:
http://www.syncfusion.com/faq/winforms/search/895.asp

=============================================
Clay Burch, .NET MVP

Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials


"Justin Emlay" <NOSPAM...@Maisto.com> wrote in message
news:edxH0hhX...@tk2msftngp13.phx.gbl...

Justin Emlay

unread,
Jun 29, 2004, 6:37:28 PM6/29/04
to
Thanks Clay,

I found that article and one like it however I have no clue as to
implementing it into my current project.

Any clues?

Justin

"ClayB [Syncfusion]" <cl...@syncfusion.com> wrote in message
news:OOqtlqh...@TK2MSFTNGP10.phx.gbl...

Dave Hall

unread,
Jul 2, 2004, 10:16:53 PM7/2/04
to
You'll have to figure out when it's appropriate to call this method in your
application, but doing so will ensure that the last row of the dataGrid is
always visible when it returns. It won't choke even if there are not enough
records to activate the automatic scroll bars, and it's independent of any
data binding.

public static ScrollLastRowIntoView(DataGrid dataGrid)
{
if(dataGrid == null) return;
if(dataGrid.Visible)
{
foreach(Control control in dataGrid.Controls)
{
if(control is VScrollBar)
{
VScrollBar scrollBar = (VScrollBar)control;
if(scrollBar.Visible)
{
scrollBar.Value = scrollBar.Maximum;
}
return;
}
}
}
}

Good Luck,
Dave


"Justin Emlay" <NOSPAM...@Maisto.com> wrote in message
news:edxH0hhX...@tk2msftngp13.phx.gbl...

0 new messages