Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i need to make the text in a text b

Status
Not open for further replies.

itechC

Programmer
Feb 13, 2003
71
0
0
CA
i need to make the text in a text box a hyperlink. Any ideas. Thanks
 
Put these two lines in the declaration section of a form or in a module

Const SW_NORMAL = 1

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
_______________________________________________________

Put a label on a form and make the caption look like a hyperlink. Something like - " and make it light blue(maybe underline it).

Next put this code in the labels click event.

ShellExecute frmAbout.hwnd, "open", lblHomePage.Caption, "", "", SW_NORMAL

The ShellExecute will open up the users default browser and go to the web address passed to it.

You simply pass ShellExecute 6 things:
1. The form hwnd - In my case the frmAbout.hwnd

2. The operation to be done - in my case the "open" command

3. The file name - In my case the label caption, or pass it a string with the web address.

4. Any Parameters - In my case I had none so put empty string

5. The directory - In my case had none so put empty string

6. How to show the window when it opens - In my case I choose normal (can be hidden, or minimize also).

You could use a text box also but be sure to verify user input for a correct url.
Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top