Date: Mon, 27 Jan 2003 14:44:11 -0600 (CST) From: Mark Jacobson To: 810-151-01@uni.edu Subject: Database guessing game... Hi 151 (Visual Basic) students, The class web page at http://www.cns.uni.edu/~jacobson/c151vb.html has links to the web page from fall of 2002. Download the Access 97 version of the Movies database, which is named movies.mdb. It has two tables and one query definition. I will assume you will become totally familiar with it by studying all of the material located at ~jacobson/c030.html from fall of 2002. It is also found at: http://www.cns.uni.edu/~jacobson/vbDatabaseMovies.html Your movies guessing game should have the following features: 1. The main form displays a scrambled movie name, chosen only from the one word movies from the database, using the QueryDef that is stored in the movie database that you download. 2. The main form allows the user to enter a guess as to what the name of the movie is. You probably want to have a TextBox for this, instead of using an InputBox() function. Your textbox can have a command button for checking the user's guess, but it also should recognize when the user has typed the Enter key, by processing KeyPress() events and watching for the Enter key (named vbKeyReturn by Visual Basic, but ASCII value of the Enter key is 13. Here is a quick example of the KeyPress event, and using the Immediate Window (where Debug.Print output goes) to verify that vbKeyReturn is the correct intrinsic constant name for the Enter key, and that it is naming 13. Private Sub Text1_KeyPress(KeyAscii As Integer) Debug.Print KeyAscii If KeyAscii = vbKeyReturn Then Debug.Print "That last one was the Enter key!" End If End Sub Here is the actual output created when the TextBox Text1 was used. I had to backspace 5 times to get rid of the Text1 default .Caption characters. A, a, 0, and 9 are ----- shown. 8 Backspace key = 8 8 Backspace key 8 Backspace key 8 Backspace key 8 Backspace key = 8 65 A 97 a = A + 32 = 65 + 32 = 97 48 0 57 9 13 Enter key = 13 That last one was the Enter key! 3. The main form informs the user whether their guess was correct or incorrect. 4. If the user's guess was correct, the command button for picking another scrambled movie name to guess gets the focus. The .Caption on that command button should say something appropriate for this very moment, such as Way to Go! Try Another One? or You Got Lucky. Dare you to try another! 5. The above command button will display a different message when the user is playing the game at other times. The user will be allowed to pick a different scrambled movie name at any time. 6. The user will be able to click a button or do a menu choice to see all of the unscrambled one word movie names. The 2nd form that comes up will show all the one word film names (film titles) that are in the database. It will show them in a Microsoft FlexGrid control. 7. The user will be able to click a button or do a menu choice to see all of the quotes that the database has that are associated with the currently scrambled movie title. Like the example handed out today in class, your guessing game should allow the user to leave the display all quotes window open, and change to a different scrambled movie title to guess, and see all of that different movie's quotes, when the game player again activates the display all quotes form. You may add extra features to this program, as you see fit. Be sure to print out the code for each of the THREE different forms you have used, as well as screen snapshots demonstrating the application in action. ---------------- This program will be due on Monday, February 3rd by the end of the day. Slide it under my door if you do not turn it in during class that day. ----- Mark