How do you use the keyboard keys in the form? Tutorial
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts
Page 1 of 1
Hello everyone..
Have you ever wondered how to get your form to do something by pressing a button on the keyboard? Well problem solved!
See here is a code I use for my web browser for my address bar so when I press enter it navigates although this is not what you are looking for it is the same idea.
Thanks for looking at this tutorial!
Have you ever wondered how to get your form to do something by pressing a button on the keyboard? Well problem solved!
See here is a code I use for my web browser for my address bar so when I press enter it navigates although this is not what you are looking for it is the same idea.
Code: Select all
Now as you can see it works and you can change the keys.enter to keys.space or keys.b or whatever you need. Private Sub ComboBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter Then
'Navigate to the current address.
If ComboBox1.Text = My.Settings.Blocked(Form3.ListBox1.SelectedItem) Then
MsgBox("This site has been blocked, to unblock it go under tools and blocked sites.", MsgBoxStyle.Critical)
Else
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
End If
My.Settings.History.Add(ComboBox1.Text)
ListBox2.Items.Clear()
For Each Item As String In My.Settings.History
ListBox2.Items.Add(Item)
ComboBox1.Items.Add(Item)
Next
Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Web Browser Elite"
'Prevent the sound that indicates an invalid key press.
e.SuppressKeyPress = True
End If
End Sub
Thanks for looking at this tutorial!
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
good job
but these are called hotkeys
but these are called hotkeys
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

oh they are? my bad.
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
just saying so you can get more views on topic im not mad or nothing just telling cooll;
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

oh i know but I was just saying my bad because i didn't know
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
oh ok
lol
lol

Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that 

6 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023