Display form after application has ran for certain amount of times.

How can I get the application to display a different form (as opposed to default start up form) after the aplication has run for, say, 10 times?

Thank you

[162 byte] By [airsam] at [2008-1-9]
# 1

you need to store this value somewhere, such as in your app.config settings file or the registry. It is recommended to store it in the app.config rather than the registry simply because of security reasons (you may not have permission to access the registry)

so create an app settings and save that setting when you close the app (add 1 to the existing value) then when loading, check the value to see if its 10.

Right click on your project > Properties. Press the Settings tab and add a setting named "TotalTimesRan" of type Integer and the scope being Application with the default value of 0.

When your application runs, on the form load event, read/check that value:

if My.Settings.TotalTimesRan = 10 then

'show other form

else

'show first form

end if

when closing your app, on the form closing event, set the value:

My.Settings.TotalTimesRan = My.Settings.TotalTimesRan + 1

'save:

My.Settings.Save()

does this help?

ahmedilyas at 2007-10-2 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...