473,473 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

KeyPress within a web browser

1 New Member
Hi there, i am currently trying to create a web browser within Visual Basic 6 but the problem i am having is that i want the program to execute a web address upon pressing the enter key (the web address would be in a text box)

I have got the web browser to execute a web address upon selecting it from a drop down list of favorites, this is the only way it will navigate the Internet for me.

Here is my code if that helps: -

Option Explicit

Dim KeyCode As Integer


Private Sub Command1_Click()
Favourites.RemoveItem 1
End Sub

Private Sub Command2_Click()
Dim Favourite_name As String
Open "F:\Favourite.txt" For Append As 1
Favourite_name = Text1.Text
Write #1, Favourite_name
Close #1
Favourites.Clear
Open "F:\Favourite.txt" For Input As 1
Do While Not EOF(1)
Input #1, Favourite_name
Form1.Favourites.AddItem Favourite_name
Loop
Close #1

End Sub

Private Sub Command3_Click()
WebBrowser1.GoBack
End Sub

Private Sub Command4_Click()
WebBrowser1.GoForward
End Sub

Private Sub Command5_Click()
WebBrowser1.Stop
End Sub

Private Sub Command6_Click()
WebBrowser1.GoHome
End Sub

Private Sub Favourites_Click()
Dim Clicked_item As String
Dim Number_index As String
Number_index = Favourites.ListIndex
Clicked_item = Favourites.List(Number_index)

WebBrowser1.Navigate Clicked_item

End Sub


Private Sub Form_Load()
Dim Favourite_name As String
WebBrowser1.Navigate "www.google.co.uk"
Open "F:\Favourite.txt" For Input As 1
Do While Not EOF(1)
Input #1, Favourite_name
Form1.Favourites.AddItem Favourite_name
Loop
Close #1

End Sub

Thanks
Jan 23 '08 #1
2 2507
kadghar
1,295 Recognized Expert Top Contributor
Hi there, i am currently trying to create a web browser within Visual Basic 6 but the problem i am having is that i want the program to execute a web address upon pressing the enter key (the web address would be in a text box)

I have got the web browser to execute a web address upon selecting it from a drop down list of favorites, this is the only way it will navigate the Internet for me.
(...)
Thanks
I think im not understanding you quite well, but do you want the application to do something when you press [Enter] in the textbox?

just add the code in the KeyDown Event of the Text_Box, under an IF, something like:

Expand|Select|Wrap|Line Numbers
  1. if keycode = 13 then 'im not sure, but i think 13 is the keycode for [enter]
  2.     '[write here the browsing code]
  3. end if
Jan 23 '08 #2
Killer42
8,435 Recognized Expert Expert
Another way to trap Enter is to have a command button which is hidden behind something or off the display, with the Default property set to True.
Jan 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Trevor Fairchild | last post by:
I'm writing a program that is designed for quick navigation using specific buttons on the keyboard. In doing this, I have added a KeyPress event for every control on the form to intercept the key...
8
by: George Hester | last post by:
When the address bar is highligted? That is nothing on the page is selected. The address bar is selected. Capture keydown or keypress? Any ideas using javascript? Thanks. -- George Hester...
4
by: phil_gg04 | last post by:
Dear Javascript Experts, I'm currently implementing Anyterm, a terminal emulator on a web page. It consists of an Apache module, some XmlHTTP and a bit of Javascript. The idea is to give you...
7
by: Dave Hammond | last post by:
You'd think this was an occasionally asked question, but a search for previous related posts only turned up one from 1999, and that one was never anwered. So... When handling a keypress event,...
3
by: Raul M. Colon | last post by:
Is possible to assign a click event to a button control in a Web form just pressing the return key? Something like windows forms where you can assign this action to a default control. For example,...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
4
by: Michael Green | last post by:
Hi, In VB6 you used to be able to modify keys as they were pressed in the KeyPress event e.g. change it uppercase, remove certain characters etc. How do I do this in .NET ? Regards Michael
4
by: Jeff | last post by:
....still new at this. ...hopefully a simple question Is there some practical way of altering the function of a keypress in Visual Web.net 2005 using VB without causing a postback on each...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.