how do I set a shortcut key for 1 of the textboxes in vb.net.
When I goto the textbox and press F3, then it should give the current date in the textfield...Can somebody help me with this??
Thanks in advance..:)
prancode 0 Newbie Poster
Recommended Answers
Jump to PostWhy cant u try like this
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.F3 Then MessageBox.Show(e.KeyCode.ToString) Else MessageBox.Show(Keys.KeyCode.ToString) End If End Sub
Jump to PostI just gave as example to show Which key is pressed for testing.. You need to take only what u need.
Jump to PostIn keydown event my code works good for me... Why cant you try that code in keydown? Instead of messagebox you can write ur code what you want to do after user pressing F3 key...
Jump to PostThis should work for you..
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.F3 Then TextBox1.Text = Now().Date.ToShortDateString() End If End Sub
Jump to PostPlease mark thread as solved.. :)
All 19 Replies
M.Waqas Aslam 67 Posting Pro in Training Featured Poster
prancode 0 Newbie Poster
Cronicle8 0 Newbie Poster
prancode 0 Newbie Poster
daniel955 7 Light Poster
prancode 0 Newbie Poster
M.Waqas Aslam 67 Posting Pro in Training Featured Poster
prancode 0 Newbie Poster
prancode 0 Newbie Poster
Pgmer 50 Master Poster Featured Poster
prancode 0 Newbie Poster
Pgmer 50 Master Poster Featured Poster
Cronicle8 0 Newbie Poster
prancode 0 Newbie Poster
Pgmer 50 Master Poster Featured Poster
Pgmer 50 Master Poster Featured Poster
prancode 0 Newbie Poster
prancode 0 Newbie Poster
Pgmer 50 Master Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.