?
Solved

display website

Posted on 2002-05-20
3
Medium Priority
?
169 Views
Last Modified: 2010-05-02
How can I display a website through VB a user enters into a text box. Also is it possible to return search results using any search engine, yahoo, google, on a word the user enters into another text box.
0
Comment
Question by:wsa
[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 Comments
 
LVL 2

Expert Comment

by:vbDoc
ID: 7021931
Hi,
In VB you will find web objects. Click on Project/Components. Click on Microsoft Internet Controls. Also check out Microsoft Internet Transfer Control.

Regards,
vbDoc
0
 
LVL 17

Accepted Solution

by:
inthedark earned 400 total points
ID: 7023358
You can do this in 2 ways:

1) Simple

a)Add Project component Microsoft Internet Controls

b)Open tool box then click on the Globe (Webbrowser Control) and place on your form.

c)Add the following:

Private Sub Form_Load()

WebBrowser1.Navigate2 "http://www.microsoft.com"

End Sub

d)Hit Run!


You get the web-site on your form.

So you can add a textbox and a Go Command button:

Sub cmdGo_Click()
WebBrowser1.Navigate2 text1
End Sub


2) Complex

Add the project component "Microsoft Internet Transfer Control"

dim url as string
dim PageData as string
dim ok
url="http://www.yourserver.com"

ok = DownloadFileOK(url, pagedata)
if not ok then
  msgbox "could not get data from site"
else
  label1.caption = PageData
end if

Now de-code the htlm in pagedata and display details ina picture box (thats the hard bit).

Have fun.....

Function DownloadFileOK(url As String, DataReturned As String) As Boolean

Dim b() As Byte
Dim bc As Long
Dim bl As Long


Dim purl As String

purl = url

On Error Resume Next
Err.Clear
b = Inet.OpenURL(purl, icByteArray)

If Err.Number = 0 Then
   DownloadFileOK = True
   bl = UBound(b)
   DataReturned = Space$(bl + 1)
   For bc = 0 To bl
       Mid(DataReturned, bc + 1, 1) = Chr$(b(bc))
       DoEvents
   Next bc
Else
   DownloadFileOK = False
   ErrorNumber = Err.Number
   ErrorReason = Err.Description
End If

Erase b

End Function


0
 

Author Comment

by:wsa
ID: 7025747
Thanks inthedark the simplified solution works great. Do you know the best way to perform a search on a word the user enters into the text box, using yahoo, etc?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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