Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

308 Part II Programming Fundamentals



  1. Click the form again. (You might need to click the form’s icon on the Windows taskbar .)

  2. Click the List Recent Sites button.


Visual Basic executes the event procedure for the Button2 object. You see a message
box that looks like this:


  1. Click OK in the message box, type a different Web site in the form’s text box, and then
    click the Visit Site button.


Tip You might want to visit the Microsoft Visual Basic Developer Center site, located at
http://msdn.microsoft.com/vbasic/, to learn more about Visual Basic.


  1. Visit a few more Web sites by using the URL Collection form, and then click the List
    Recent Sites button.
    Each time you click List Recent Sites, the MsgBox function expands to show the growing
    URL history list, as shown here:


If you visit more than a few dozen Web sites, you’ll need to replace the MsgBox function
with a multiline text box on the form. (Can you figure out how to write the code?)


  1. When you’re finished, click the Close button on the form, and then close your Web
    browser.
    Congratulations! You’ve learned how to use the Controls collection and how to process
    collections by using a For Each... Next loop. These skills will be useful whenever you work
    with collections. As you become more familiar with classic computer science data structures
    and algorithms related to list management (stacks, queues, dictionaries, hash tables,

Free download pdf