Date: Tue, 18 Jul 2006 13:02:49 -0500 (CDT) From: Mark Jacobson To: 810-030-01@uni.edu Subject: Web Browser assignment... Due on Friday... Visual Basic students, Please read and DO Hour 9 (Chapter 9) of the book, so you know about Menus in Visual Basic 2005. Review of today's class follows here. Here is what my bookmarks.txt file looked like: ----------------------------------------------------------------------- http://www.cns.uni.edu/~jacobson;Mark Jacobson at UNI http://www.cns.uni.edu/~jacobson/bio;Bioinformatics Links http://www.cns.uni.edu/~jacobson/c030NET.html;Summer 2006 Visual Basic www.google.com;Google http://www.imdb.com/;The Internet Movie Database (IMDb) ----------------------------------------------------------------------- Notice the semicolon ( ; ) character is the separator... Notice the format of the two fields is: field 1; field 2 where field 1 = the actual URL and field 2 = the descriptive bookmark, usually the TITLE of the web page, which is stored in the DocumentTitle property of the WebBrowser1 control. Me.Text = WebBrowser1.DocumentTitle sets the Form's .Text property to display the title after the browser control's Navigated() event has happened. (See your handout). Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated Me.Text = WebBrowser1.DocumentTitle ... other code ... txtURL.Text = WebBrowser1.Url.ToString End Sub After class I tested out the following, and found out that Do Until URL = "" URL is a String variable, set by ... URL = myFavs.ReadLine() Loop works exactly the same as Do Until URL Is Nothing ... Loop What is myFavs, you ask?? Dim myFavs As New System.IO.StreamReader("C:\MarkJacobson\bookmarks.txt") ------ ------ An input stream from which we extract records like: http://www.imdb.com/;The Internet Movie Database (IMDb) URL URL URL URL URL ; Bookmark description TITLE of page a = URL.Split(";") SPLIT record into its two separate fields, and store in array a(), a(0) would be "http://www.uni.edu/" and a(1) would be "University of Northern Iowa" See http://www.cns.uni.edu/~jacobson/emailSplit030.txt for an example program from Visual Basic .NET that uses the .Split method and function. If you get a chance, try to write the code for the rewriteBookmarks() Sub before class. Sub rewriteBookmarks() ---------------- ' this sub will update the bookmarks file. End Sub For sure, try to finish up individually what the group exercise started, which was adding a bookmark.... The following code from btnNewHome_Click() would be handy to study when writing btnAddNewBookMark_Click() code... Private Sub btnNewHome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewHome.Click HomePageURL = InputBox("What would you like to be your new home page", "Set Home Page", WebBrowser1.Url.ToString) homeChanged = True End Sub The InputBox() shown above has THREE arguments. The 3rd argument is the DEFAULT, which means the user only need click OK and not type anything into the inputbox, to accept the default. ------------------------------------------------------------------------- http://www.sitcomsonline.com/familyties.html FAMILY TIES ----------- ***** Michael J. Fox as Alex P. Keaton ***** First Telecast: September 22, 1982 Last Telecast: September 17, 1989 Total number of episodes: 180 The mellow 1960s clashed with the conservative 1980s in this generation-gap comedy, which in some ways reflected America's changing values in the Reagan area. President Reagan, in fact, called Family Ties his favorite show. It was set it middle America--Columbus, Ohio--where one-time flower children Elyse and Steve Keaton still espoused the liberal values of the idealistic '60s, although they were now parents and professionals (she an architect, he the manager of public TV station WKS-TV). Their children's ideals were something else. Seventeen-year-old Alex was Mr. Conservative, habitually dressed in suit and tie and with a picture of William F. Buckley, Jr., over his bed. Mallory, 15, was into designer jeans, boys, and drunk food, while cute little Jennifer, 9, just wanted to be a kid. They were a loving family, though the kids never could understand those Bob Dylan records their parents kept playing. ------------------------------------------------------------------------- As you can see, Michael J. Fox indeed did star in the Family Ties show, as Alex Keaton. In Back to the Future his character name was: Marty McFly Tagline: He's the only kid ever to get into trouble before he was born. Plot Outline: In 1985, Doc Brown invented time travel, in 1955, Marty McFly accidentally prevented his parents from meeting, putting his own existence at stake. ------------------------------------------------------------------------- See you tommorrow in class. Mark