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.?
Printable View
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.?
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
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
That could really screw up if the app crashes without a chance to decrement the counter. Just beware of that.
Hello,
How would you do it?.