Nevron Forum

Getting keyboard input when a button is clicked

https://www.nevron.com/Forum/Topic13136.aspx

By Jobelle Firme - Tuesday, November 24, 2020

Hi,

I was wondering if there is a way to get keyeventargs when a button is clicked? To be specific, I wanted to know if the Shift key was pressed when the Delete button was clicked.

I currently have:

AddHandler RibbonButtonDelete.Click, AddressOf ButtonDeleteFile_Click
Private Sub ButtonDeleteFile_Click(ByVal e As NEventArgs)
   'code here
 End Sub


Thank you.
By Nevron Support - Wednesday, November 25, 2020

Hi,

You can use the NKeyboard.ShiftPressed property to check if the Shift key is pressed. For example:


Private Sub Button_Click(ByVal e As NEventArgs)
  If (NKeyboard.ShiftPressed) Then
   MessageBox.Show("Shift pressed!")
  End If
End Sub