Hello, i have always thought to cancel a key a user pressed, you can just write e.Handled = False. I was wrong...
Below is a quick example of making it so in a textbox if the user clicks the period/decimal it will not enter the period/decimal in the textbox it will enter a comma.
vb Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.OemPeriod Or e.KeyCode = Keys.Decimal Then e.SuppressKeyPress = True SendKeys.Send(",") End If End Sub
You can use the above code as a layout, modify it etc...




Reply With Quote