1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Public Class Form2
Private Sub Form2_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Dim strSqlquery As String = _
"SELECT * FROM Matable"
Dim ad As New OleDb.OleDbDataAdapter(New OleDb.OleDbCommand(strSqlquery, Cnn))
Dim ds As New DataSet
ad.Fill(ds)
Me.DataGrid1.DataSource = ds
End Sub
Private Sub DataGrid1_ControlAdded(ByVal sender As Object, ByVal e As System.Windows.Forms.ControlEventArgs) Handles DataGrid1.ControlAdded
If TypeOf e.Control Is DataGridTextBox Then
AddHandler e.Control.KeyPress, _
New KeyPressEventHandler(AddressOf Control_KeyPress)
End If
End Sub
Private Sub Control_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
e.KeyChar = UCase(e.KeyChar)
End Sub
End Class |
Partager