Come posso fare per inserire in un progetto di vb dei tasti funzione (se si chiamano così).
Mi spiego meglio: io vorrei avere la possibilità di fare in modo che premendo ad esempio il tasto F6 si aprisse un determinato form.
Grazie mille!
Come posso fare per inserire in un progetto di vb dei tasti funzione (se si chiamano così).
Mi spiego meglio: io vorrei avere la possibilità di fare in modo che premendo ad esempio il tasto F6 si aprisse un determinato form.
Grazie mille!
Ti basta impostare su True la KeyPreview del form "principale" e intercettare il codice del tasto premuto nella KeyDown del form.
Ciao !codice:If KeyCode = 117 Then 'Apri il form End If
Grazie!
Sei stato gentilissimo
dove posso trovare i numeri corrispondenti ai vari tasti?
nn riesco a farlo andare
guarda cosa ho trovato nei miei vecchi appunti
codice:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 112 Then Label1.Caption = Label1.Caption & " F1" End If If KeyCode = 113 Then Label1.Caption = Label1.Caption & " F2" End If If KeyCode = 114 Then Label1.Caption = Label1.Caption & " F3" End If If KeyCode = 115 Then Label1.Caption = Label1.Caption & " F4" End If If KeyCode = 116 Then Label1.Caption = Label1.Caption & " F5" End If If KeyCode = 117 Then Label1.Caption = Label1.Caption & " F6" End If If KeyCode = 118 Then Label1.Caption = Label1.Caption & " F7" End If If KeyCode = 119 Then Label1.Caption = Label1.Caption & " F8" End If If KeyCode = 120 Then Label1.Caption = Label1.Caption & " F9" End If If KeyCode = 121 Then Label1.Caption = Label1.Caption & " F10" End If End Sub
Grazie mille!Originariamente inviato da Johnny_Depp
guarda cosa ho trovato nei miei vecchi appunti
codice:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 112 Then Label1.Caption = Label1.Caption & " F1" End If If KeyCode = 113 Then Label1.Caption = Label1.Caption & " F2" End If If KeyCode = 114 Then Label1.Caption = Label1.Caption & " F3" End If If KeyCode = 115 Then Label1.Caption = Label1.Caption & " F4" End If If KeyCode = 116 Then Label1.Caption = Label1.Caption & " F5" End If If KeyCode = 117 Then Label1.Caption = Label1.Caption & " F6" End If If KeyCode = 118 Then Label1.Caption = Label1.Caption & " F7" End If If KeyCode = 119 Then Label1.Caption = Label1.Caption & " F8" End If If KeyCode = 120 Then Label1.Caption = Label1.Caption & " F9" End If If KeyCode = 121 Then Label1.Caption = Label1.Caption & " F10" End If End Sub
Penso che invece di fare quella seri infinita di IF sia meglio fare una SELECT CASE KeyCode!!
Ma poi, non sarebbe + semplice creare un menu (magari invisibile se non lo vuoi vedere) nell' MDI form e associare ad ogni voce l'opzione ShortCut con il tasto desiderato (F1, F2, F3, ...)?
grazie, proprio quello ke mi serviva.
:mavieni: