Public Class Form1
Public Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
Dim CurrentForm As Form = DirectCast(sender, Form)
MsgBox(e.KeyChar.ToString + " " + CurrentForm.Name)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AddHandler Me.KeyPress, AddressOf Form1_KeyPress
Public Class Form2
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AddHandler Me.KeyPress, AddressOf Form1.Form1_KeyPress
Set the KeyPreview property to true on each form. When you run this whichever form has the focus will echo the key pressed and the form name to the messagebox.
i am trying to create a library management system which is supposed to be used to store/keep infp for the library and the library members( book title, author, name and picture for borrower and other stuffs). The app has 6 buttons, delete, save, add,previsous,next, and upload( for upload ...