Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am programming virtual keyboard with images, when I press the button it will display image but am not able to code space and backspace...

VB
Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
Dim myDir As String = "C:\Users\ASUBUSU\Desktop\keyboard\java pgm\"
Dim img As Image = Image.FromFile(myDir &"ya.png")
Dim orgData = Clipboard.GetDataObject
Clipboard.SetImage(img)
Me.RichTextBox1.Paste()

Clipboard.SetDataObject(orgData)

End Sub
How to write code for space and backspace in button click

Thanks...

What I have tried:

VB
If e.KeyChar = Convert.ToChar(Keys.Back) Then
Posted
Updated 28-Mar-16 4:40am
v2
Comments
Tomas Takac 17-Mar-16 5:46am    
KeyPress[^] seems to be very limited. Maybe you would be better off using KeyDown[^] event.

declare

Private Kbd as new Microsoft.VisualBasic.Devices.Keyboard



and where you want to send back space insert this line there


Kbd.SendKeys(Chr(Keys.Back))
 
Share this answer
 
You can use SendKeys.Send() method to send backspace and space keys

Or else you can use PostMessage to stimulate keypress.
Tell where you want to send the keys
 
Share this answer
 
v2
Comments
Member 12398243 21-Mar-16 4:40am    
I need to give in Rich text box.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900