Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
A1VBCode Forums
Home
Search
Members
Calendar
Who's On
Welcome Guest
(
Login
|
Register
)
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
»
Classic Visual Basic (VB 6 or earlier)
»
General Visual Basic
»
Restart form
Restart form
Rate Topic
Display Mode
Topic Options
Author
Message
Coruscent
Coruscent
Posted 6/6/2008 9:23:48 AM
Forum Newbie
Group: Forum Members
Last Login: 6/7/2008 1:21:12 AM
Posts: 2, Visits: 2
Is there a way I can restart a form like it has been exited and started again? Otherwise I would have to reset every counter, sprite, timer and everything manually.
Post #25134
Mark
Mark
Posted 6/6/2008 12:03:27 PM
Forum God
Group: Moderators
Last Login: 2 days ago @ 1:42:32 PM
Posts: 1,073, Visits: 9,408
I'm not sure this is the best way of doing it but it should work. It will take 2 forms. For this sample on Form one place a command button and use this code.
Option
Explicit
Dim
strText
As
String
Private
Sub
Command1_Click()
Dim
frm
As
Form
strText = "Testing"
'The load event of form 2 will reload form1'
Form2.Hide
'check if form2 is loaded and unload if it is
For
Each frm In Forms
If
frm.Name = "Form2"
Then
Unload frm
Set
frm = Nothing
End
If
Next
frm
End
Sub
Private
Sub
Form_Load()
Me.Caption = strText
End
Sub
And here is the code for Form2
Option
Explicit
Private
Sub
Form_Load()
Unload Form1
'To test comment this line and check the caption on form 1
Set
Form1 = Nothing
Form1.Show
End
Sub
Post #25135
Coruscent
Coruscent
Posted 6/7/2008 1:26:51 AM
Forum Newbie
Group: Forum Members
Last Login: 6/7/2008 1:21:12 AM
Posts: 2, Visits: 2
Ok thanks
Post #25136
« Prev Topic
|
Next Topic »
Reading This Topic
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators:
Admin
,
Mod
,
Mark
,
Keithuk
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
may
send private messages.
You
cannot
send email's.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Forum Jump...
----------------
Forum Home
Search
Members List
Calendar
Who's Online
----------------
Announcements
|-- Announcements
.NET Programming (VB 2010 or earlier)
|-- Visual Basic .NET
|-- ASP.NET
|-- C#
Classic Visual Basic (VB 6 or earlier)
|-- General Visual Basic
|-- Database Programming
|-- COM/ActiveX
|-- API
|-- Internet/Communications Programming
|-- VBA(Excel, Word, etc...)
|-- Game Programming
General Discussion
|-- Forum Feedback
|-- Member Chat
|-- Introductions
All times are GMT -5:00, Time now is 3:41am