Solved

100 pts for urgent question 2

Posted on 2002-03-05
6
142 Views
Last Modified: 2010-05-02
how to open a website/URL from VB?
0
Comment
Question by:wuyinzhi
[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
6 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 80 total points
ID: 6841175
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 Const SW_SHOW = 5

ShellExecute Me.hwnd, "open", Trim$(txtWebsite.Text), vbNullString, vbNullString, SW_SHOW
0
 
LVL 28

Expert Comment

by:Ark
ID: 6841178
Hi
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

Public Sub NavigateTo(sUrl As String)
   Call ShellExecute(0&, vbNullString, sUrl, vbNullString, vbNullString, vbNormalFocus)
End Sub

Cheers
0
 

Expert Comment

by:aseem_dayal
ID: 6841359
Hi,

See if this helps :

1. Go to your project refferences and select "Microsoft    
   Internet Controls", which is a refference to shdocvw.dll

2. Add the following code for a command button click :

Dim ws As SHDocVw.InternetExplorer

Private Sub Command1_Click()

Set ws = New InternetExplorer

ws.Visible = True
ws.Navigate ("www.google.com")

End Sub

To use alternative browsers use the WebBrowser class included in this library.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:vettranger
ID: 6841873
Or, if you need to see the web page code from inside your VB program :

url$ = "http://www.something.com"
q$ = Inet1.OpenURL(url$)

q$ now has the code from the web page to parse as you'd like.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6842066
:))
0
 
LVL 3

Author Comment

by:wuyinzhi
ID: 6843508
thanks all, especially to ryancys who gave me the solution first. Anyway just curious, is it possible to access an asp page without open the browser?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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
Course of the Month8 days, 14 hours left to enroll

615 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