|
-
Jun 16th, 2012, 04:34 PM
#1
Thread Starter
Frenzied Member
run project 2 times
Hello,
How would i go about getting my application to run 2 times then show form 2 then once they close form2 it dosent show form 2 anymore once the program starts again after closing.?
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Jun 16th, 2012, 05:04 PM
#2
Re: run project 2 times
If i understood well, you want to show form2 when the program run for first time and don't show it next runs, if so, use a flag saved in your settings file to check if form 2 was previously shown or not.
Pseudo code
vb Code:
read f from setting file
if f = 0 then
show form 2
f = 1
save f to setting file
else
' continue
end if
-
Jun 16th, 2012, 05:21 PM
#3
Re: run project 2 times
Sounds like you only want to show some other form the second time the app is run, you could try setting up an Integer in Project/Properties/Settings...
Code:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' get value from my settings named "OpenCounter" (type = Integer, Value= 0).
Dim i As Integer = My.Settings.OpenCounter + 1 ' increment counter
If i < 2 Then ' dont show on first run
My.Settings.OpenCounter = i ' save count to setting
My.Settings.Save() ' save my settings
ElseIf i = 2 Then ' show form2 just this once.
My.Settings.OpenCounter = 3 ' increment to 3, never show form2 again!
My.Settings.Save() ' save my settings
Form2.ShowDialog() ' show form as dialog to force user to respond
End If
End Sub
-
Jun 17th, 2012, 04:35 AM
#4
Re: run project 2 times
That could really screw up if the app crashes without a chance to decrement the counter. Just beware of that.
-
Jun 17th, 2012, 10:49 AM
#5
Thread Starter
Frenzied Member
Re: run project 2 times
Hello,
How would you do it?.
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|