Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6758867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:51:21+00:00 2026-05-26T13:51:21+00:00

Currently I have the start-key for my vb.net application hardcoded like this: GetAsyncKeyState(Keys.F2) Where

  • 0

Currently I have the start-key for my vb.net application hardcoded like this:

GetAsyncKeyState(Keys.F2)

Where vb.net sais “F2 As System.Windows.Forms.Keys = 113” on mouse-over

But I want my users to be able to pick their own Key. If I make a drop-down box (combobox) and pre-define some choices in there (Like ESC or F3), all those choices are strings. How can I convert those strings to a System.Windows.Forms.Keys integer?

Also, I’d like it to also be possible to “capture” a single keypress. So they’d click the “capture” button, and the next key they hit will be saved as the start/stop button. But I wouldn’t even know where to begin looking for that one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:51:22+00:00Added an answer on May 26, 2026 at 1:51 pm

    Try something like this:

    Public Class Form1
        Dim captureKey As Boolean
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            captureKey = True
        End Sub
    
        Private Sub Button1_PreviewKeyDown(sender As Object, e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles Button1.PreviewKeyDown
            If captureKey Then
                Label1.Text = e.KeyValue.ToString
                captureKey = False
            End If
    
        End Sub
    End Class
    

    I created a form with a label and a button for an example. e.KeyValue is an integer that I am converting to a string for display purposes. You also have the ability to capture other keydata. See this info on PreviewKeyDownEventArg

    As for the first part of your question use a Select Case Statement to convert between your ComboBox Values and KeyData Values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have interfaces much like the following: interface IService { void Start(); IHandler
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I have a .Net 2.0 application written in C# that monitors other Windows XP
I have a wizard in my asp.net MVC application which is built upon this
I have couple resource DLLs that I currently load when application starts using following
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have a fairly robust server-side validation system in place, but I'm looking
I currently have heavily multi-threaded server application, and I'm shopping around for a good
I currently have PHP code that handles the logic for this because I do
I currently have speakers set up both in my office and in my living

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.