This is a very simple method to allow a user to enter a value in a TextBox without a physical keyboard. I used the double click event in order to allow the option of single click for physical keyboard and double click for virtual keyboard.
- In Solution Explorer, double click MainForm.vb to open in design view
- In the Toolbox, under All Windows Forms group, add a TextBox to the form
- With the TextBox selected, go to the Properties Window and at the top click the lightening bolt to see the event list
- Find the DoubleClick and double click in the are to the right of it. This will take you back to the code
- Insert the code shown here:
Private Sub TextBox1_DoubleClick(sender As Object, e As EventArgs) Handles TextBox1.DoubleClick
Dim kpd As New MfgControl.AdvancedHMI.Controls.AlphaKeyboard
If kpd.ShowDialog = DialogResult.OK Then
TextBox1.Text = kpd.Value
End If
End Sub
- Run the application and double click on the Textbox