19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

EXAMPLE 2<br />

The following enhancement of Example 1 adds a label that shows the status of the Web Browser control,<br />

a comm<strong>and</strong> button that returns you back to the most recently accessed page, <strong>and</strong> a comm<strong>and</strong> button that<br />

displays the Prentice-Hall web site. (The picture of the Prentice-Hall trademark is contained in the Pictures<br />

directory of the accompanying CD.)<br />

Add the following code to the program in Example 1.<br />

Accessing the Internet with <strong>Visual</strong> <strong>Basic</strong> 395<br />

Object Property Setting<br />

frm14_2_2 Caption Simple Web Browser<br />

lblURL Caption URL:<br />

txtURL Text (blank)<br />

lblStatus Caption (blank)<br />

cmdRetrieve Caption &Retrieve Document<br />

Default<br />

cmdBack Caption &Back<br />

cmdPH Caption (none)<br />

Style Graphical<br />

Picture PHICON.BMP<br />

CmdQuit Caption &Quit<br />

WebBrowser1<br />

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)<br />

‘Event is called whenever the address of the page being<br />

‘displayed changes. The address is assigned to the string Text.<br />

lblStatus.Caption = Text<br />

End Sub

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!