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 Postshortcut key ? please explain little bit . and as i understand your question you can do like this.
' use this code on the textbox keypress event if e.keychar = chr(keys.f3) textbox1.text = now().tostring end if
hope this will help you.
Regards
Jump to PostYou have to use it in the Keypress Event. Or else it won't work.
Jump to PostHandles txtsanc_date.TextChanged
should be
Handles txtsanc_date.KeyPress
Jump to Postplease use this code , it is working fine at my end.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(Keys.Enter) Then TextBox1.Text = Now().Date.ToShortDateString End If End Sub
this code is not working with f3 or any …
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
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.