Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 841
  • Last Modified:

Hyperlink...vb6

In Form load, I have:

txt1="jsmith@hotmail.com"

How can I make it appear as a hyperlink text?
0
Mike Eghtebas
Asked:
Mike Eghtebas
  • 6
  • 3
2 Solutions
 
avi247Commented:
Create a label Label1 on Form. Then add this code.

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

Private Sub Label1_Click()
ShellExecute hWnd, "open", "http://www.experts-exchange.com", vbNullString, vbNullString, conSwNormal
End Sub
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
avi247,

How do I make it appear like a hyperlink.  I am testing your code now.

Mike
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi avi247,

To test my computer settings, I pasted 'jsmith@hotmail.com' on a word document, as expected, it changed to a hyperlink.  Upon clicking on it, it launched outlook.
-------
Using your code, it gave me error on 'conSwNormal'
-------

btw, I had the exct user-defined function in use in my application which works fine and opens various applications.  In place of 'conSwNormal', it uses 1.  This function is declared public.

Itiered to use the existing user-defined function with 'conSwNormal' and 1, it didn't work.  I tired declaring it private in the form window where it is used, it didn't work.

Now, I am trying the link posted by EDDYKT.

Regards,

Mike
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
btw, I had 'jsmith@hotmail.com' in a text box not in alable.  It was firring okay.
0
 
avi247Commented:
Mike:
Try this instead above in the label. I tested it and it works.

ShellExecute hWnd, "open", "mailto:jsmith@hotmail.com", vbNullString, vbNullString, 0
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
It worked.  But, I changed its forecolor to neon blue to resemble to hyperlink.  It doesn't appear as hyperlink.

Mike
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
EDDYKT,

Thank you for providing the link.

Mike
0
 
avi247Commented:
Thanks Mike..you could also have it underlined and stuff if you want to further enhance it, Label>Properties>Font
I assumed you know how to do this and concentrated on the base functionality.
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
I used mouse move event to chnage its color and underline it.  There is also a golobal boolean variable to be set to True when the link is clicked to make sure the color of the text changes to purple.  On mouse move event of the form itself, I change the color to black (when the cursor is moved away from the lable).  All is fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now