Could I make two programs, but with one icon/startup so that when you click the icon, it runs both programs?
Thats my first question.
My other question is for something else, how can I make something delete files? Thanks.
Could I make two programs, but with one icon/startup so that when you click the icon, it runs both programs?
Thats my first question.
My other question is for something else, how can I make something delete files? Thanks.
First Question:
Yes you can do that. You would need to use the sub main procedure. The sub main is usually used for things like a splash screen, but you could use it to start two seperate threads.
Second Question:
You would need to import file IO, but yes you can delete a file or files.
Chester
Can you describe the "sub-main procedure" to me? Sorry, I'm a noob.
Can you describe the "sub-main procedure" to me? Sorry, I'm a noob.
Right Click on your project and the click Add New Item
Click Module
Name your Module
Open the new Module
Between the Module Header and Footer, type Sub Main() and enter
Now enter your code.
On the Solution Explorer right click and click on your settings, under startup, click Sub Main.
Hope this helps.
Chester
Thanks, but one more thing..."Now enter your code" which code is that? Like the code that opens both of them or what? Thanks.
Thanks, but one more thing..."Now enter your code" which code is that? Like the code that opens both of them or what? Thanks.
Yes, it would be the code to launch each program. I actually think what he was trying to do is to have your project load two forms, instead of two exe's. You could just as easily have 1 of your exe's launch your other EXE on form load.
You could just as easily have 1 of your exe's launch your other EXE on form load.
So how would I do this method?
Since you are in VB.Net The System.Diagnostics namespace exposes a Process class:
Dim myProcess As Process = System.Diagnostics.Process.Start("c:\somepath\somefile.exe")
obviously, you will need to change "c:\somepath\somefile.exe" to the path of the program that you want to launch (in this case, your other program). That should effectively launch the exe. Now, just stick that in your form load... and whenever EXE 1 runs, it will launch EXE2 by default.
There are more ways than one to accomplish what you want....
Chester
Ya I thought I'd look at both of them and see what one I thought would be easier.
i'm currently working on a school project, which is making a game, in VB.Net. I was having trouble trying to find out how to code a countdown timer so when the timer stops the game is over. Could someone please help me?
There should be a timer control (looks like a stop watch, I think). Set it's interval to 1000 (which is 1 second (1000 milliseconds)). Now, every second this timer event will fire. In Your declaration section of the form (where you declare form wide variables) add a public variable to keep track of the time, call it: timevariable. In The Form Load Event of your form, set the variable to the max amount of time (the number you want to start at). Then, in the timer event (every second), add this:
if timevariable = 0 then
msgbox "game over"
exit sub
end if
timevariable = timevariable - 1
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.