I have a datagridview in which i have several columns and each column has different datatypes like dates, address, phone numbers.
So, to prevent the user from entering a unwanted data in the fields we are using key press events.
For the phone field i am calling this event.
Private Sub dgvSchedules_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvSchedules.EditingControlShowing
Dim strColumnHeader As String
strColumnHeader = dgvSchedules.Columns(dgvSchedules.CurrentCell.ColumnIndex).HeaderText
If (strColumnHeader = "Start_Phone" AND Not e.Control Is Nothing Then
AddHandler tb.KeyPress, AddressOf cls_Global.NumericText_KeyPress
This part is working good. But when i move out of this cell and enter into the next cell which is a address field, it is not allowing me to enter alphabets. I can only enter numbers.
Why is this happening? How can i prevent this?