From jacobson@math-cs.cns.uni.edu Mon Jun 10 15:58:02 2002 Date: Mon, 10 Jun 2002 15:57:04 -0500 (CDT) From: Mark Jacobson To: 810-030-01@uni.edu Subject: Web page and handouts... Hi Visual Basic students, The web page is now up to date and the URL is: http://www.cns.uni.edu/~jacobson/c030.html The VB web page is easily found from http://www.cns.uni.edu/~jacobson Study over today's handout, but be aware that the web page PowerPoint presentation has additional material not on the handout that you might find useful. I also put the code and screen snapshots of today's Visual Basic example with its Form_Click() and Form_Load() and cmdClear_Click() events. Recall that the cmdClear_Click() event changed the Backcolor or the Forecolor for the frmDemoOne Form object. frmDemoOne.Forecolor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd) frmDemoOne.Backcolor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd) ObjectName.ProperyName = new property value ---------- ----------- = ------------------ Private Sub cmdClear_Click() ' <---This is a command button event... frmDemoOne.Cls ' Clear the Screen - Clear screen End Sub ' -- - Private Sub Form_Click() frmDemoOne.ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd) Print "Hello World" frmDemoOne.Print "Go Panthers" frmDemoOne.Caption = Time End Sub Private Sub Form_Load() MsgBox "Go Panthers" ' MsgBox for Message Box with OK button... End Sub Properties, Methods and Events Print and Cls and Methods, things that Form objects know how to DO. Forecolor and Backcolor and Caption are Properties, things that enable objects to remember an important characteristic. Click() and Load() and KeyPress() are events. Events are something that objects know how to detect and respond to by executing whatever statements and actions we specify for the given event. Properties, Methods and Events P, M, E Three types of things. Objects such as command buttons and labels are created by using the Toolbox. All Objects have properties. The (Name) property, Caption property, Backcolor property, Forecolor property, ... Properties can be set at DESIGN time or at RUN time. Many objects know how to act or do certain things. We can tell a form to CLEAR itself with the .Cls METHOD. Or tell it to Print on itself, using the Print METHOD. See you on Tuesday. You are NOT expected to understand most of Monday's 1st lecture example and handouts until Wednesday or so. Mark