如何在datagridview
唯一字符限制keypress
ABCDE並轉換爲vb.net爲大寫?按鍵上datagridview的唯一字符「ABCDE」,並轉換爲大寫
Private Sub DataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
If DataGridView1.CurrentCell.ColumnIndex = 3 Then
AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBoxabcde_keyPress
End If
End Sub
Private Sub TextBoxabcde_keyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If Not Char.IsControl(e.KeyChar) And Not Char.IsLetter(e.KeyChar) And e.KeyChar <> "." Then
e.Handled = True
End If
End Sub
我在e.KeyChar = UCase(e.KeyChar)中出現錯誤,但按鍵限制僅適用於字符abcde –
究竟錯誤說的是什麼? – Claudius
@FendyPlick現在嘗試 – Claudius