How to determine if the scroll bar of a WebBrowser is at its default position?

pisceswzh

Well-known member
Joined
Mar 19, 2007
Messages
96
Programming Experience
1-3
Hi,

I am working on a program that has a datagrid and a webbrowser in a form. When the user clicks on one row in the grid, the webbrowser will display something that is related to the selected row.

My problem is the datagrid is supposed to auto reload every 1 min and if the reload happens when the user is reading something in the middle of a webbrowser (I mean the scroll bar has been scrolled to the middle), after the reload the webbrowser is just reset (the content is not changed, but the scroll bar is back to the top).

So what I want to do is NOT to reload if the scroll bar is not at its default position (the top of the webbrowser). Now the problem is how can I determine if a scroll bar of a webbrowser is at its default position?

Or is there any better solution in my situation?

Thanks!
 
Why reload the webbrowser if datagrid row hasn't changed?
 
Since I don't know whether the datagrid has been changed, so I need to reload the datagrid. Before I reload the datagrid, I record which row the user has been selected and after the reload I re-select this row. So the user won't feel anything, but this row has acutally been re-activated. And I set the load webbrowser event when the row is activated. So the webbrowser is consequently reloaded.

I feel this approach is a little bit awkward. Is there a better way to do the reload?
 
I record which row the user has been selected and after the reload I re-select this row.
Why don't you know whether the datagrid has been changed?
I set the load webbrowser event when the row is activated. So the webbrowser is consequently reloaded.
What if you use a Boolean variable "hasChanged" and only reload webbrowser if row has changed?
 
Why don't you know whether the datagrid has been changed?

This program is used by more than one user at a time on different computers. Therefore the datagrid may have been changed by other users.
 
You can analyze this. Btw DataGridView don't change, data may change.
Simply as this: first you navigate the browser to "page123", next time you want to navigate browser, for example to "page123", just check first if not this is already current page (Url or other marker).
 
Yes, that might be a good approach.

I am going to assign the webbrowser'tag with the PK of the row and when the row is activated, I first check if the webbrowser's tag = row's PK, if it is FALSE then load.

Thank you.
 
Back
Top