DtaGrid Evento KeyDown

venerdì 28 settembre 2007 - 15.19

IlCondor72 Profilo | Newbie


Ciao a Tutti

Ho bisogno di aiuto.

Qualcuno può dirmi perchè quando sono all'interno della datagrid non scatta
l'evento keydown ne quello della datagrid ne quello sul form su cui ho
settato keypreview = true?

Ho scritto le seguenti funzioni :

Private Sub Clienti_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
MsgBox("Clienti_KeyDown")

' Gestione Tastiera
If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Then
FuncKeysModule(e.KeyValue)
e.Handled = True
End If
End Sub

Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyDown
MsgBox("DataGrid1_KeyDown")

' Gestione Tastiera
If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Then
FuncKeysModule(e.KeyValue)
e.Handled = True
End If
End Sub

Public Sub FuncKeysModule(ByVal value As Keys)
Select Case value
Case Keys.F1 ' Indietro
Me.Close()
Case Keys.F2
Case Keys.F3 ' Ricerca
Try
'''''''''''''''''''''''''''''''''''''''''
' Aggiornamento DataGrid dal DataSet dal DataAdapter
'''''''''''''''''''''''''''''''''''''''''
DataView1.RowFilter = "CodiceCliente Like '" + Replace(CodiceCliente.Text, " ", "") + "' And RagioneSociale Like '" + Replace(RagioneSociale.Text, " ", "") + "' And Localita Like '" + Replace(Localita.Text, " ", "") + "' And CodiceFiscaleOPartitaIVA Like '" + Replace(CodiceFiscaleOPartitaIVA.Text, " ", "") + "'"
'''''''''''''''''''''''''''''''''''''''''
Catch Ex As Exception
End Try
Case Keys.F4
MsgBox("Keys.F4")

' Determina il Codice Cliente dal DataGrid
Dim Cursore As Integer = CInt(DataGrid1.CurrentRowIndex.ToString)
VariabiliGlobali.CodiceCliente = DataGrid1.Item(Cursore, 0)

' Chiude la Maschera
Me.ActiveForm.Close()
Case Keys.F5
Case Keys.F6
Case Keys.F7
Case Keys.F8
Case Keys.F9
Case Keys.F10
Case Keys.F11
Case Keys.F12
End Select
End Sub

Nonostante le 3 funzioni non riesco a catturare l'evento Tastieradal dataGrid.

Grazie per l' aiuto
Il Mio Sito : http://xoomer.alice.it/francescovattimo/
Il Mio Blog : http://francescovattimo.blogspot.com/
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5