Coding question - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19) +---- Thread: Coding question (/showthread.php?tid=4040) |
Coding question - ElephantShoe - 12-29-2009 I'm very new to VB, or coding in general, but I followed an Auto Clicker tutorial because I thought it would be very easy and good to start with. Everything works, except I'm not too sure on how to make a hotkey. I have two buttons, "Begin" and "Stop." I want to assign F10 to Begin and F12 to Stop. I have this code already: Code: Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer From what I know, you'll be needing a Timer to make the hotkey. But now, I'm totally confused. If anyone would like to see the source for more info, just post. Also, how do I put in a picture in the background so my GUI looks better? RE: Coding question - dunlop03 - 12-29-2009 No timer needed , heres the code: Code: Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown Set the "KeyPreview" property to "True" on form1 If you cant see it use this code in the "Form1_load" event : Code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load RE: Coding question - ElephantShoe - 12-29-2009 (12-29-2009, 01:58 PM)dunlop03 Wrote: No timer needed , heres the code: Thanks it worked, but do you know how to make it passive? Meaning, is there a way to make the hotkeys work if the program is minimized? Also, this might be easy. I have a "Clear" button. I'm wanting it to clear all of the text fields. I've tried searching but no luck. RE: Coding question - thanasis2028 - 12-30-2009 (12-29-2009, 05:40 PM)ElephantShoe Wrote: 1)Thanks it worked, but do you know how to make it passive? Meaning, is there a way to make the hotkeys work if the program is minimized? 1) to do that you will need the code you wrote at the start of this post. I can't help you though because I don't know the details. 2) You must set the text of each textbox to "" Code: textbox1.text="" RE: Coding question - dunlop03 - 12-30-2009 Yes use the button click event to clear all the textboxes , labels etc. Heres an example. Code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click |