Attaching website links to your command button.


Hi, i'm very new at VB6! I was wondering how can you insert a website link to a command button.

Example:

When you click the command button it will open your internet browser, and it'll go to the website that was attached to your command button.

What's the code or how do you do it?

If you enjoyed this post, subscribe for updates (it's free)

How to access web without using shell?

How to access a web page without using Shell function?

How to add link

How to add link in vb6.0 command button, its easy method

step1: make a command button
step2: copy the following code and then click run
Code:
Private Sub Command1_Click()
Dim theWebSite As String
theWebSite = "http://www.Zohaibart.blogspot.com"
Call Shell("explorer.exe " & theWebSite, vbNormalFocus)
End Sub

it does not work for me sir

it does not work for me sir

urdu novels urdu stories0

it also works for firefox

just put this command

islamislamibooks

It's wonderfull how this code works!!
I appreciate your code. it's very helpfull
Thanks a lot!!!

a

thnx so much from ClaweD ;)

programmer

How to connection database to internet use vb 6?thank

bvnbvn

bvnbvn

http://1.bp.blogspot.com/-pg8

http://1.bp.blogspot.com/-pg8DiAXpl3k/TvdzrHuOpqI/AAAAAAAAAB0/8IsqWdvB_uc/s1600/1342390.jpg

A video clip of the very influential American preacher Yusuf Estes

http://www.youtube.com/v/5J-9dn3_hpY&rel=0&autoplay=0&color1=bdbdbd&color2=bdbdbd&border=0

Thank you so much

I tried every one of them before but this is the relay works!!

thank you so much I tried

thank you so much I tried them all and this is the only one that worked!!!

Shell Explor

Dim theWebSite As String
theWebSite = "http://www.google.com.pk"
Call Shell("explorer.exe " & theWebSite, vbNormalFocus)

is good

You Want A Link Button, Huh?

i have a problem in this code onclick=[removed]SAPprint(1) , this is in a WAD (Web Application Designer ) Application. I need to find the SAPprint(1) because i believe this code call the template that will be displayed in the Web. Can you please help me where can i find this code. thanks.

Use Web Browser control , its

Use Web Browser control , its navigate method will fulfill your need

thanx

thank you very much friends .. thies codes are really very useful to me..

For a default browser ???

how can go to a web site by just clicking om on a command button to go through the default browser ???

Thx ppl

Hello guys.
Thx for help. I was looking for that information and now I've found. :)
[]'s

my way

all i do is:
Dim theWebSite As String
theWebSite = "http://randomsite.com"
Call Shell("explorer.exe " & theWebSite, vbNormalFocus)

thank's

thank's

beside link vb to website,

beside link vb to website, is it possible to create a link in website that link to my vb project?
i mean create a link in website, when click the link it will open the system that i build using vb...
thanks..

TRY THIS!

Dim ret As Long, theWebSite As String
theWebSite = "http://www.URL.COM"
ret = ShellExecute(Me.hwnd, "open", theWebSite, vbNullString, vbNullString, 3)
If ret < 32 Then MsgBox "There was an error when trying to open a default browser", vbCritical, "Error"

I know!

I know a SIMPLE way!

Dim ret As Long, theWebSite As String
theWebSite = "http://www.URL.com"
ret = ShellExecute(Me.hwnd, "open", theWebSite, vbNullString, vbNullString, 3)
If ret < 32 Then MsgBox "There was an error when trying to open a default browser", vbCritical, "Error"

thanks alot

thanks alot

Visual basic

I am expert in using in VB6 but this would really help me as I am searching on the net for a long time.

then please dont call

then please dont call yourself an expert.
if you can not find outsomthing that takes a beginner 5 mins of his life to find, dont bother

How I link to web-site (Own created HTML document) by using VB

Regard for the above title

I would like to link VB6 with Web (HTML document that I create myself).
Its the above forum can support for HTML document??

Thank you for reply. Appreaciate it....

ShellExecute

With ShellExecute it will open your default web browser to you don't have to tell it
"c:\program files\internet explorer\iexplore"

The ShellExecute API is a powerful tool. You can open/run any file that is registered in the registry. Print any file and Email anyone you want too.

Keith
www.martin2k.co.uk/forums/

I've been programming with VB for 13 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning

Best Way (works for all browsers)

The best way is like this. Here's the API call...

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
Const SW_SHOW = 5

Put this Public Sub at the bottom of all your code:

Public Sub OpenWebsite(URL As String)
Dim ret&
ret& = ShellExecute(Me.hWnd, "Open", URL, vbNullString, vbNullString, SW_SHOW)

Then this code in your button/menu etc...

OpenWebsite "http://www.clubpenguinvbcodes.co.cc"</code<
 
~412mark412 8)

i want code to link web page

i want code to link web page to my vb6.0 command button... pls tell me asap

i want code to link web page

i want code to link web page to my vb6.0 command button... pls tell me asap

gee!!

It's wonderfull how this code works!!
I appreciate your code. it's very helpfull
Thanks a lot!!!
Felix

Very useful - thanks! :-)

Very useful - thanks! :-)

Running a web link

Shell is a bit antiquated for this operation. Your best bet to run anything in VB the ShellExecute API call.

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
 
Const SW_SHOW = 5
 
Private Sub Command1_Click()
 
Call ShellExecute(Me.hwnd, "open", "http://www.vb6.us/forums", vbNullString, vbNullString, SW_SHOW)
 
End Sub
<code>
 
<strong>Keith</strong>
<a href="http://www.martin2k.co.uk/forums/">www.martin2k.co.uk/forums/</a>
 
I've been programming with VB for 13 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning

immediate help

i want full coding to link a web page in vb6.0 pls....

when i use you code it says

when i use you code it says this "only commands may appear after End Sub, End Function, or End Property. how can i overcome this problem pls tell me soon

accesing web links using vb script

Hi, I am very new to vb. I am able to launch IE browser, login to my required application perfectly using vb. But the problem is, i can't find the code to access any web link or web edit box in that page. Any help would be greatly appreciated.

help..

when i use you code it says this "only commands may apear after End Sub, End Function, or End Property.

dude thanks!

thanx man i owe you one!

[RE] Attaching website links to your command button.

easiest way:

private sub form_load()
dim strLink as string
strLink = "http://www.vb6.us"
shell "c:\program files\internet explorer\iexplore " & strLink
end sub

DjoeDjoe

Thank you so much I tried

Thank you so much I tried every one of them before but this is the only one that works!!

Thanks Dude.... This is

Thanks Dude....

This is quite simple. But the explorer opens in very minimized way. is there any way out.

only works for IE not

only works for IE not firefox or anything else

it also works for

it also works for firefox

just put this command

Dim strLink As String
strLink = "https://http://www.google.co.in/"
Shell "C:\Program Files\Mozilla Firefox\firefox " & strLink

tq so much

tq so much

thnx so much from ClaweD ;)

thnx so much from ClaweD ;)

Good job :)

I don't believe he was looking to get into anything complicated, so this method is the easiest, good job. :)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.