I'm trying to make every time I press a key on the keyboard it is replaced by special symbols anscii:
But in all textbox controls, richtexbox everything that can be entered a value.
But I have a form2 called with: me.controls.add(form2)
and also when I precionar selected in the second form that the same values are valid for any.
I thought of the following method:
Create a module with all key definitions:
Module:
So in the form's keydown call:Code:Public sub keysubbcall() If e.keypress = Keys.A then Set selected.text = "AnciiCode112" end if If e.keypress = Keys.A then Set selected.text = "AnciiCode113" end if end sub
But from what I thought it doesn't work well, I'd like it to work in all but only selected regardless of the form, even if it's an exe called done in vb being toplevel(false)Code:call module.kepress(keysubcall)
is there any way to do this without using the method I've always done but always for something definite:
But I would like it to work on any text input control.Code:if e.keys = kepress.a then textbox1.text &= "Ancii112" end if
Code:Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Form1.Keypreview = True End Sub ' Internet Ref: 'REM : https://stackoverflow.com/questions/13727172/vb-net-keydown-event-on-whole-form '************************************************************************* Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown If e.Control AndAlso e.KeyCode = Keys.S then ' Call your sub method here ..... YourSubToCall() ' then prevent the key to reach the current control e.Handled = False End If End Sub




Reply With Quote
