Hi I am having a requirement in my project where User press '.' in his num pad and he wants the character ',' to be displayed (dats bcoz he is French User).

I tried changing the e.KeyCode but it is a readonly property.

Is there any other way to change the key in key events? please let me know and it very important and would be great help for me now.

Thanks in Advance

Recommended Answers

All 2 Replies

Use next code:

Private Sub TextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox.KeyPress
        Dim ascii As Integer = Asc(e.KeyChar.ToString)
        
        ' Ascii code for comma is 46
        If ascii = 46 Then
            e.KeyChar = ","
        End If
    End Sub

hey that helped thanks a ton

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.