Ok, I want my program so that it has a form that loads up when the app runs but if the user clicks a certain cmdbutton then a different form will load up everytime the App is run. How do i do this?
Printable View
Ok, I want my program so that it has a form that loads up when the app runs but if the user clicks a certain cmdbutton then a different form will load up everytime the App is run. How do i do this?
Hi BorT. What you want to do would be very easy if you save the name of the form in an INI file. You may save this value when the user clicks that Command Button, and read it from the INI file when your application starts.
You can do this by using the API functions called: WritePrivateProfileString, and GetPrivateProfileString... I'm not sure if their names are exactly that ones. If you can't find them, let me know and I'll search.
Does it help you?
You could check a registry setting, and, if it's set to, say, 1, then you'd load the second form. Otherwise, you'd load the first form. You could set the value to 1 when the command button is pressed and check it when your program is opening (you'd probably want to use Sub Main instead of a form load then). Here's a link for using GetSetting and SaveSetting:
From MartinLiss's signature: http://www.vbforums.com/showthread.p...hreadid=232113
And the best way to implement it would be to have your startup object be Sub Main and then Show any form you want to show from there.