Discussion Locked

Visual Basic Hyperlink Text Boxes

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I create a hyperlink text box in VB 6.0 like I can do in Access? I haven't been able to find an answer in any of my textbooks on VB. Thanks.

3 replies

by classicmanpro

Declaration
-----------------------------------------
Private Declare Function ShellExecute Lib _
"shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory _
As String, ByVal nShowCmd As Long) As Long
----------------------------------
Call the defaule browser
-----------------------------------
ShellExecute 0&, vbNullString, "www.youraddress.com", vbNullString, _
vbNullString, SW_SHOWNORMAL

by jrobins

I discovered a simple approach of my own to answer this question. On a second form, I added a WebControl for viewing the Internet site that's referenced in the and then added the following code to the textbox double-click event:

Private Sub Text1_DblClick()
Dim URL As String
URL = txtURL.Text
Form1.WindowState = 1
Form2.Show
Form2.WebBrowser1.Navigate URL
End Sub

On Form2 I added a "Return" button to close that form and go back to Form1.

Hope this simple approach helps others who might be trying to do the same thing.

This discussion is closed to new replies.