title: Get Key Pressed in Variable - Visual Studio Basic 2017
body: <p>I am trying to make a simple program, pasting in whatever you write in a textbox. I am doing this in Visual Studio 2017. It is a Windows-Forms App with Visual Basic. It works in the current state, but I woud like to add the ability to customize the key. Right now, when you press F12, it sends the message. I want a simple way of asking the user for a key, and after he presses it, it gets set as the new paste key. Any idea how I can accomplish this? Thanks in advance.</p>
  
  <p>My code below, where I have Keys.F12 I have/want a variable that holds the key set by the user.</p>
  
  <pre><code>Dim hotkey As Boolean
  hotkey = GetAsyncKeyState(Keys.F12)
  If hotkey = True Then
  SendKeys.Send(TextBox1.Text)
  End If
  </code></pre>