Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Determining Position, Min, Max of Vertical Scroll Bar in DataGridView
 

Determining Position, Min, Max of Vertical Scroll Bar in DataGridView

I'm working on a Page Loading Dataset wrapper, and I realized that as much as I can load a page at a time from the DB into the DataTable, this means nothing if I don't know when to load the next page. I naturally assumed I would just listen to the Scroll bar events for the DataGridView and/or the position indicator on the bindingsource, when I discovered that the DataGridView only has a simple "OnScroll" event, and in that event one is only provided the NewValue and OldValue of the current scroll bar position.

Is there a way to get the Min/Max of the the scroll bar so that I know what the "NewValue" is relative to? (Ie, have we scrolled more than 60% down through the available rows, then load the next page, etc)

Thanks

Jaeden "Sifo Dyas" al'Raec Ruiner
"Never Trust a computer. Your brain is smarter than any micro-chip."
JaedenRuiner  Tuesday, July 14, 2009 7:28 PM
Hi JaedenRuiner,

If you don't need to use DataBinding, I recommend you to use Virtual mode. It is well designed for large data.
How to: Implement Virtual Mode in the Windows Forms DataGridView Control
http://msdn.microsoft.com/en-us/library/2b177d6d.aspx

First I think you can load data from database in another thread, when all the data are get from your database, you can handle CellValueNeeded event to fill the data.

CellValueNeeded and CellValuePushed event are the most important in virtual mode. It will allow you dynamically fill the data to the DGV and write the edited data into datasource.

Here is also another related topic talking about that.
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/702f3ad7-9109-4755-8377-35aeff0381a4

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Thursday, July 16, 2009 3:45 AM
Hi JaedenRuiner,

If you don't need to use DataBinding, I recommend you to use Virtual mode. It is well designed for large data.
How to: Implement Virtual Mode in the Windows Forms DataGridView Control
http://msdn.microsoft.com/en-us/library/2b177d6d.aspx

First I think you can load data from database in another thread, when all the data are get from your database, you can handle CellValueNeeded event to fill the data.

CellValueNeeded and CellValuePushed event are the most important in virtual mode. It will allow you dynamically fill the data to the DGV and write the edited data into datasource.

Here is also another related topic talking about that.
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/702f3ad7-9109-4755-8377-35aeff0381a4

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Thursday, July 16, 2009 3:45 AM

You can use google to search for other answers

Custom Search

More Threads

• DataGrid Checkbox Selection Requires 2 Clicks
• Another DataGridView Background Row Color question ....
• TableAdapter Datasets and a parameter
• binding comboboxes
• How do I disable the AddNewItem button on the bindingNavigator control ?
• ProcessDialogKey doesn't get called
• How to set column size in DataGridView contorl
• DataGridView: What if I don't want selected row always in visible area?
• Hierachical Grid
• Windows Form DataGridView