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 27 28 29 30 31 32 33 34 35 36 37
|
Option Strict Off
Public Class Form2
Public intNbFrappe As Integer = 0
Private Sub Form2_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Dim strSqlquery As String = _
"SELECT ..."
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)
intNbFrappe = intNbFrappe + 1
If intNbFrappe = 2 Then
intNbFrappe = 0
Exit Sub
End If
e.Handled = True
SendKeys.Send(UCase(e.KeyChar))
End Sub
End Class |
Partager