Question Key Down

PRo-Beaniie

Well-known member
Joined
Mar 17, 2011
Messages
55
Location
Hertford, Hertfordshire, United Kingdom
Programming Experience
3-5
Hey guys,

im looking for some code that can enable a e.keyvalue event when a player hits an object on form but i also want the form to load with the e.keyvalue event disabled any one know how to do this ?
 
To my knowledge you can't "disable" the e.KeyValue (in KeyDown and KeyUp events). I'm not sure exactly what you are looking for, but you could try putting a boolean switch in there somewhere.

VB.NET:
Private useKeyCode As Boolean = False
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If useKeyCode = True Then 
       'do your code here
       Me.Text = e.KeyCode
    End If
End Sub

'To enable using the keycodes
Private Sub enableKeyCodes
    useKeyCode = True
End Sub

I'm not sure if this is what you were looking for, but I hope it helps or gives you an idea.

-Josh
 
Let us know if you need something else!
 
yeah there is somthing else i dont know wether your familliar with this code but is there a way to link this code to a timer like have the progress bar increase for the seconds elapsed...

this code is designed to stop the progress bars exeeding thier maximum value....

HEALTHBAR.Increment(Math.Min(25, HEALTHBAR.Maximum - HEALTHBAR.Value))
 
Simply put that code into a timers 'Tick' event. You can then set the timers interval and the HEALTHBAR's value increment for your needs.
 

Latest posts

Back
Top