Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Next/Previous through "pages" 1

Status
Not open for further replies.

MDA

Technical User
Jan 16, 2001
243
US
Hi all,

I have a simple "Wizard" like project. I am using user controls in a main form with back and forward buttons on the main form. I am trying to find an efficient way to move forwards and backwards through the pages.

I have been unsuccessful in figuring out a way to do this and cannot seem to find an example online using VB.NET.

Anyone have an idea on how I can accomplish this?

I guess I first need to assign a “page #” to each user control and than figure which page is currently showing and hide/make visible the correct page based on the user interaction of the Next and previous buttons??? Just a guess…


Thanks in advance,
MDA
 
I'm not sure I understand correctly. But you have a single form, and depending on which "page" it is on, want to hide or show certain controls?

Well the first thing to do is since these controls are logically grouped, I would place each "page's" controls in their own panels. I would possibly create a custom panel control, inheriting from Panel, and adding a public variable called Page.

I would then have a module-level variable in the form called Page. When your forward button is clicked, then increment your form's page. Likewise, when your back button is clicked, decrease it.

Then, call a function that goes through your form's controls collection. If the control is a panel, check and see if its .Page equals your form's Page variable. If it does, then show it. If not, then hide it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top