Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Scrollable Panel scrolls back to top

$
0
0
Hi, all.
Short version: I have a scrollable Panel (Panel1) containing numerous Userforms that scrolls back to the top after a UserForm at it’s bottom is refreshed/updated. I want it to stay where it was - with the selected UserForm in view. Any/all help greatly appreciated. Thanks!

Details: I’m teaching myself VB.Net (Visual Studio 2010). Previous experience with VB6, so I’m familiar with a lot of the language, but not great with OOP and the .Net framework (yet). Anyway, I’m creating an employee scheduler – Panel1 contains an array(20,7) of UserForm1. UserForm1 contains various info about an employee’s shift, and also fires a ‘Double_Clicked’ event whenever it is double-clicked. For each UserForm, I used AddHandler to point each UserForm’s Double_Clicked event to a single ‘Box_Double_Clicked’ procedure, passing only the object that fired the event. Box_Double_Clicked parses the UserForm’s unique number, and performs action(s) against the UserForm and/or the entire app, depending on which UserForm is double-clicked. So – for example, when the user scrolls to the bottom of the panel, double-clicks a UserForm in the bottom row(s), after the UserForm is updated, the panel scrolls back to the top, and I need it to stay wherever it was before the double-click. The only info I’ve found was setting/restoring Panel1.Scrollbar.AutoScrollPosition, but I couldn’t get that to work.

I’m sure I’ve violated a ton of standards, and surely there’s a better way to go about this. But, it’s trial & error learning, and it’s still just a hobby, for now, and I love it. Hopefully I described what I’m doing well enough. Anyway, can anyone offer guidance? Thanks !

-J.D.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>