|
-
Dec 6th, 2008, 02:07 AM
#1
Thread Starter
New Member
[2008] Basic, easy question
lol okay i agree im a complete noob at this.
This is what i need to do when i click the Enter button i want it to open up game.exe, game exe and the game launcher will be in the same folder
Thanks
Last edited by AllanS; Dec 6th, 2008 at 02:13 AM.
-
Dec 6th, 2008, 02:25 AM
#2
Re: [2008] Basic, easy question
Instead of using the thread title to tell us that it's a basic, easy question, please let us judge the level of difficulty and use the thread title to actually describe the problem.
As for the question, we need more info. What does your launcher UI look like? Why are you using a launcher instead of just a regular Windows shortcut?
-
Dec 6th, 2008, 02:28 AM
#3
Thread Starter
New Member
Re: [2008] Basic, easy question
mmm okay, well my game launchers very simple, it haves 3 buttons and a background, buttons are Enter, Forums, Exit, there is also a webbrowser on it for news.
Im and using a luancher because it produces more infomation about the game.
-
Dec 6th, 2008, 02:44 AM
#4
Re: [2008] Basic, easy question
Can I assume that your Enter button is to run the game and your Exit button is to quit the app? If so then you should assign them to the AcceptButton and CancelButton properties of the form respectively. The AcceptButton is "clicked" when the user hits the Enter key and the CancelButton is "clicked" when the user hits the Escape key.
-
Dec 6th, 2008, 02:52 AM
#5
Thread Starter
New Member
Re: [2008] Basic, easy question
 Originally Posted by jmcilhinney
Can I assume that your Enter button is to run the game and your Exit button is to quit the app? If so then you should assign them to the AcceptButton and CancelButton properties of the form respectively. The AcceptButton is "clicked" when the user hits the Enter key and the CancelButton is "clicked" when the user hits the Escape key.
lol im a complete noob sorry i have no idea, think we could chat on msn or somthing?
-
Dec 6th, 2008, 02:58 AM
#6
Re: [2008] Basic, easy question
 Originally Posted by AllanS
lol im a complete noob sorry i have no idea, think we could chat on msn or somthing?
You've set properties on your form before, e.g. Text. This is no different. Open the form in the designer, open the Properties window and set the AcceptButton and CancelButton properties. Done.
-
Dec 6th, 2008, 06:14 AM
#7
Re: [2008] Basic, easy question
If I understand correctly this question is about how to launch a program not how to set a default button on a form.
All you need to do is add a line at the top of your code to import "System.Diagnostics" and then use the Process.Start method :
vb Code:
Imports System.Diagnostics Public Class frmLauncher Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Process.Start("game.exe") End Sub End Class
You would probably want to throw in some error checking to make sure that game.exe is there etc, but that code will launch the application assuming it is there in the same folder as the launcher as you stated.
-
Dec 6th, 2008, 06:21 AM
#8
Re: [2008] Basic, easy question
 Originally Posted by keystone_paul
If I understand correctly this question is about how to launch a program not how to set a default button on a form.
All you need to do is add a line at the top of your code to import "System.Diagnostics" and then use the Process.Start method :
vb Code:
Imports System.Diagnostics
Public Class frmLauncher
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("game.exe")
End Sub
End Class
You would probably want to throw in some error checking to make sure that game.exe is there etc, but that code will launch the application assuming it is there in the same folder as the launcher as you stated.
Good point. I kinda focused on the:
when i click the Enter button
and not so much on the:
i want it to open up game.exe
So, keystone_paul has shown you how to execute a file on a Button Click and I've told you how to invoke that Button Click when the user hits the Enter key. That just about covers the entire question.
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
|