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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reloading a form in VB.net 1

Status
Not open for further replies.

Headiswrecked

IS-IT--Management
Mar 27, 2003
12
0
0
IE
Hi, I have a form where I have set up a card game. The user has to select a card (Ace-2), followed by suit and compare it to the computer selection. Score increments when computer selection matches user selection.

What I want to do is put a button in that will restart the game, ie reset the form as if it was closed and reopened.

I'd appreciate any help.

Thanks

Headiswrecked
 
How about creating a "Form refresh" sub routine? Which will reset the form. Call it whenever and whereever you want.

Regards,
mansii
 
the perfect case for MVC and the observer pattern.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
As a newbie to VB (or any other programming), short of resetting each field to blank, how would i do a sub routine to refresh the form
 
Actually you are the guy that will help yourself, as you developed that program. Create a sub. When called, it will initialize the components, set values, ...

The best way was to create single subs to perform some actions. So for example:

private sub NewGame(sender.... ,e... ) handles NewGame.Click()
DoThis1()
DoThis2()
DoThis4()
end sub

, where Dothis1,2,4 are some subroutines to e.g. set scores to zero, set visibillity of cards, etc


Hope im clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top