Exercises

  1. 15.3 (Using ComboBoxes) Write an app that displays the names of 15 states in a ComboBox. When an item is selected from the ComboBox, remove it.

  2. 15.4 (Using ComboBoxes and ListBoxes) Modify your solution to the previous exercise to add a ListBox. When the user selects an item from the ComboBox, remove the item from the ComboBox and add it to the ListBox. Your program should check to ensure that the ComboBox contains at least one item. If it does not, display a message, using a message box, then terminate program execution when the user dismisses the message box.

  3. 15.5 (Sorting Strings) Write an app that allows the user to enter strings in a TextBox. Each string input is added to a ListBox. As each string is added to the ListBox, ensure that the strings are in sorted order. [Note: Use property Sorted.]

  4. 15.6 (File Browser) Create a file browser (similar to Windows Explorer) based on the programs in Figs. 15.14, 15.28 and 15.31. The file browser should have a TreeView, which allows the user to browse directories. There should also be a ListView, which displays the contents (all subdirectories and files) of the directory being browsed. Double clicking a file in the ListView should open it, and double clicking a directory in either the ListView or the TreeView should browse it. If a file or directory cannot be accessed because of its permission settings, notify the user.

  5. 15.7 (MDI Text Editor) Create an MDI text editor. Each child window should contain a multiline RichTextBox. The MDI parent should have a Format menu, with submenus to control the size, font and color of the text in the active child window. Each submenu should have at least three options. In addition, the parent should have a File menu, with menu items New (create a new child), Close (close the active child) and Exit (exit the app). The parent should have a Window menu to display a list of the open child windows and their layout options.

  6. 15.8 (Login User Control) Create a UserControl called LoginPasswordUserControl that contains a Label (loginLabel) that displays string "Login:", a TextBox (loginTextBox), where the user inputs a login name, a Label (passwordLabel) that displays the string "Password:" and, finally, a TextBox (passwordTextBox), where a user inputs a password (set property PasswordChar to "*" in the TextBox’s Properties window). LoginPasswordUserControl must provide public read-only properties Login and Password that allow an app to retrieve the user input from loginTextBox and passwordTextBox. The UserControl must be exported to an app that displays the values input by the user in LoginPasswordUserControl.

  7. 15.9 (Restaurant Bill Calculator) A restaurant wants an app that calculates a table’s bill. The app should display all the menu items from Fig. 15.52 in four ComboBoxes. Each ComboBox should contain a category of food offered by the restaurant (Beverage, Appetizer, Main Course and Dessert). The user can choose from one of these ComboBoxes to add an item to a table’s bill. As each item is selected in the ComboBoxes, add the price of that item to the bill. The user can click the Clear Bill Button to restore the Subtotal:, Tax: and Total: fields to $0.00.

    Fig. 15.52 Food items and prices.

    Name Category Price
    Soda Beverage $1.95
    Tea Beverage $1.50
    Coffee Beverage $1.25
    Mineral Water Beverage $2.95
    Juice Beverage $2.50
    Milk Beverage $1.50
    Buffalo Wings Appetizer $5.95
    Buffalo Fingers Appetizer $6.95
    Potato Skins Appetizer $8.95
    Nachos Appetizer $8.95
    Mushroom Caps Appetizer $10.95
    Shrimp Cocktail Appetizer $12.95
    Chips and Salsa Appetizer $6.95
    Seafood Alfredo Main Course $15.95
    Chicken Alfredo Main Course $13.95
    Chicken Picatta Main Course $13.95
    Turkey Club Main Course $11.95
    Lobster Pie Main Course $19.95
    Prime Rib Main Course $20.95
    Shrimp Scampi Main Course $18.95
    Turkey Dinner Main Course $13.95
    Stuffed Chicken Main Course $14.95
    Apple Pie Dessert $5.95
    Sundae Dessert $3.95
    Carrot Cake Dessert $5.95
    Mud Pie Dessert $4.95
    Apple Crisp Dessert $5.95
  8. 15.10 (Using TabPages) Create an app that contains three TabPages. On the first TabPage, place a CheckedListBox with six items. On the second TabPage, place six TextBoxes. On the last TabPage, place six LinkLabels. The user’s selections on the first TabPage should specify which of the six LinkLabels will be displayed. To hide or display a LinkLabel’s value, use its Visible property. Use the second TabPage to modify the web page that’s opened by the LinkLabels.

  9. 15.11 (MDI Drawing Programs) Create an MDI app with child windows that each have a Panel for drawing. Add menus to the MDI app that allow the user to modify the size and color of the paintbrush. When running this app, be aware that if one of the windows overlaps another, the Panel will be cleared.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset