26. What does the following statement do? Explain carefully. PSet (100, 200), RGB(0, 0, 255) 27. Carefully describe what the very 1st thing is that the following Visual Basic statement does or causes the computer CPU to do or perform? (The statement consists of 5 different steps). whichPt = Int(Rnd() * 3 + 1) 28. What is the 2nd action that occurs during the CPU's execution of the above Visual Basic statement? Describe it carefully and precisely. 29. What are the main two properties of a Timer control that a programmer needs to use the most often? 30. Write the event procedure for a Timer named Timer1 so that it changes the lblPanthers background color to a randomly chosen new color (one of 16 million) every 1/2 second. Write the entire event procedure, not just the statements that would go inside of it. 31. Write a command button event for the button called cmdPauseResume so that it would cause the Timer1 to stop if it was going and to start again (RESUME) if it was paused. The message on your command button should say Pause if the color changing is running and it should say Resume if it is currently paused. (This exercise relates to item 30, shown above here). 32. What is biction? Why would biction be very important in doing well on question 31 above, in a test situation? What does biction have to do with the stages and phases of problem solving? What does it have to do with listening. 33. What does the waggle dancing of bees have to do with the programming and problem solving process? 34. Why is "Resist the urge to code" one of the most important proverbs for programmers? Explain.
Compare the lstCategory_Click event code to the SQL laden version!
Named Queries make the code simpler and we can escape the scary SQL by creating and naming the 3 queries in Access in the movies.mdb database.
Common Dialog control and Databases
Another example of the Common Dialog control for the ShowOpen method and filtering for certain filetyps. See below.
Private Sub mnuOpen_Click() ' theFileName = InputBox("What file would you like to try?" & vbCrLf _ ' & "Example 1: A:\mygraphic" & vbCrLf _ ' & "Example 2: Z:\web\mybutton.gif") cdbDialog.DialogTitle = "Open a favorite graphics picture" cdbDialog.Filter = "*.gif;*.jpg;*.bmp" cdbDialog.FileName = "*.gif;*.jpg;*.bmp" cdbDialog.ShowOpen pic.Picture = LoadPicture(cdbDialog.FileName) End Sub