Hi all KEYASCII what do i use instead & location propertiess

KRAZYJOHN

New member
Joined
Jul 19, 2006
Messages
4
Programming Experience
Beginner
I used to use keyascii on vb6 alot but now its gone i duno how to use key press events at all what do i use in stead of keyascii for example if i wanted a control to move right when x was pressed what would i use.



The position propertie has gone to i used to do simple things like this to move move things control.left = control.left +50 but thats gone to now as well what do i use instead

i ve studied the msdn for ages but it makes no sense really thanks
 
The key press event has comes with a parameter.. e
It is in this parameter that the information about what key was pressed is located. For example...

VB.NET:
If e.Keys = char(..)
 
// or you can use the keys enumeration
 
If e.Keys = Keys. //select one from the list
 
Control.Location = new point(control.location.x-=50,control.location.y)
 
End if
 
Last edited:
thanks but where do i put this code i tryed alot of things im sure it should go in form key press event but i get errors maily around the e.keys thing it says it should be there its not a key word som not sure wht it is
 
Error 1 'Keys' is not a member of
heres the error i get i just dunno where else to put the code

'System.Windows.Forms.KeyPressEventArgs'. C:\Documents and Settings\USER\My Documents\Visual Studio 2005\Projects\WindowsApplication7\WindowsApplication7\Form1.vb 4 12 WindowsApplication7
 
Sorry my fault. In the parameter of the keypress event args you should have a KEYCHAR property. That should be the one you want.

VB.NET:
If e.KeyChar = char(..)

// or you can use the keys enumeration

If e.KeyChar = Keys. //select one from the list

Control.Location = new point(control.location.x-=50,control.location.y)

End if
 
Lol thanks the location code worked great once i took the = out thanks alot you saved me alot of swearing at my computer :)
 
Back
Top