Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Very Simple

Posted on 1999-07-06
8
Medium Priority
?
151 Views
Last Modified: 2010-05-02
I forgot the code I had for making a label a weblink.
It started like this, please help me finish it.
Private Sub Label1_Click()
Dim label1 as Hyperlink
Label1.NavigateTo

I forgot the rest.
0
Comment
Question by:newbie001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1522399
try this...

Label1's OnClick()

call ShellExecute(0, "open", label1.caption, vbNullString, vbNullString, SW_SHOWNORMAL)

ShellExecute() is a Win API so you gotta declare it...

Label1.NavigateTo Label1.Caption might work also... i dunno.. :))

..-=ViKtOR=-..
0
 
LVL 6

Expert Comment

by:reddarin
ID: 1522400
newbie are you using VB6?

Darin
0
 

Author Comment

by:newbie001
ID: 1522401
Yes I am using vb6, I thought I had it working without declaring anything, So (for now) I am gonna viktornets answer.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:reddarin
ID: 1522402
I haven't used the hyperlink object in a VB project, but I don't think you are recalling the code correctly.

So, I'm not sure what the right answer is. The quick and easy answer is to create the label, set the caption, draw a line under it manually, and use Viktor's code in the OnClick event. But, you will have to declare the ShellExecute API call.

You could just use the built in shell statement and avoid the API declaration.

If you want to hide the URL behind a more friendly web page name, you can use the .tag to hold the URL and the .caption to hold the friendly name like so:

Form_Load() 'or where ever is more appropriate
 label1.tag = "http://www.experts-exchange.com"
 label1.caption = "Goto Experts-Exchange"
End Sub

Label1_Click()
 shell label1.tag, vbNormalFocus
End Sub

Of course, you won't get the visual indication of the mouse turning into a pointing hand unless you add code to the Form_MouseMove() and Label1_MouseMove() events to manipulate the cursor.

I took a look around the KB at MS and I couldn't find an example of what you are trying to do. Were you perhaps using an Active Document?

Darin
0
 

Author Comment

by:newbie001
ID: 1522403
Well looks like the declare may be the best way, If viktornet re-answers I will accept the answer so he gets the points
0
 
LVL 6

Expert Comment

by:reddarin
ID: 1522404
Sounds good.
0
 

Accepted Solution

by:
pakos earned 20 total points
ID: 1522405
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 HyperJump("http://www.blablabla.com")

u can change ur mouse pinter to the finger one
and on mouse over change the color
and it works

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1522406
newbie, if you want me to get the points, you have to reject pakos' answer and let me answer... 10x

-vik-
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question