Opening a Webbrowser 
Author Message
 Opening a Webbrowser

ShellExecute API is best.

Place in General Declarations section of Form or in a module:
Public 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

Then, under your label1_Click Event"
ShellExecute Me.hwnd,"Open","mywebpage.html","","",1

hth,
s


Quote:
> Is there anyone who can tell me how to create a link from
> a Visual Basic form to a web page. Meaning someone clicks
> a label ,for example, and this opens the default web
> browser on their system to a specific page.

> Any help would be much appreciated

> Thanks in Advance,
> Jeff



Sun, 29 Aug 2004 04:56:42 GMT  
 Opening a Webbrowser
Check this example that uses a label ..
http://www.mvps.org/vbnet/code/intrinsic/sehyperlink.htm

For more ShellExecute methods, see
http://www.mvps.org/vbnet/code/shell/shellexecute.htm
--

Randy Birch
MVP Visual Basic

http://www.mvps.org/vbnet/

Please respond only to the newsgroups so all can benefit.

*** If you call the Sleep API in Bill's latest, will it have .NET dreams?
***


Quote:
> Is there anyone who can tell me how to create a link from
> a visual basic form to a web page. Meaning someone clicks
> a label ,for example, and this opens the default web
> browser on their system to a specific page.

> Any help would be much appreciated

> Thanks in Advance,
> Jeff



Sun, 29 Aug 2004 07:38:36 GMT  
 Opening a Webbrowser

Quote:

> Check this example that uses a label ..
> http://www.mvps.org/vbnet/code/intrinsic/sehyperlink.htm

> For more ShellExecute methods, see
> http://www.mvps.org/vbnet/code/shell/shellexecute.htm

There's an even easier way than that. You can create a UserControl with
a label on it, and give it a property for an URL. Then on the Click
event for the label you call
    UserControl.Hyperlink.NavigateTo URL

It's straightforward enough to set the Font, Caption, hot spot stuff
etc, and it's all much easier to make reusable. The only difficult part
is if you want the UserControl to be like a transparent label, in which
case, for a one off, it is almost certainly easier to do it the way you
suggest.

--
Trevor Prinn
Babbacombe Computers Ltd
http://www.babbacom.com



Sun, 29 Aug 2004 19:20:05 GMT  
 Opening a Webbrowser
Thank you both for your help. I have it working now.

Regards,
Jeff

Quote:
>-----Original Message-----
>Is there anyone who can tell me how to create a link from
>a visual basic form to a web page. Meaning someone clicks
>a label ,for example, and this opens the default web
>browser on their system to a specific page.

>Any help would be much appreciated

>Thanks in Advance,
>Jeff
>.



Sun, 29 Aug 2004 23:09:35 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Close word doc open in webbrowser

2. opening a webbrowser outside of vb form

3. window.open closes webbrowser but not the form itself (Sorry for duel posting)

4. window.open closes webbrowser but not the form itself (Sorry for duel posting)

5. window.open closes webbrowser but not the form itself (Sorry for duel posting)

6. Using Webbrowser Control to open and edit Word Documents

7. GSG?9: open webbrowser (32Bit)

8. WebBrowser.Navigate opens IE6

9. Open page from memory in webbrowser control

10. block webbrowser control from opening another window?

11. Webbrowser Stopping IE from opening!

12. How to force Webbrowser to open another window

 

 
Powered by phpBB® Forum Software