See the attached file.
21 .1 1 (Inventory Application with Keyboard Events) Enhance the Inventory application that you developed in Tutorial 4 to prevent the user from entering input that is not a number. Use keyboard events to allow the user to press the number keys, the left and right arrows and the Backspace keys. If any other key is pressed, display a MessageBox instructing the user to enter a number (Fig. 21.34).
a) Copying the template to your working directory. Copy the directory C: Exampl esTutori al 21Exerci sesKeyEventInventory to your C: Si mpl yVB2008 directory.
b) Opening the application's template file. Double click KeyEventInventory. sl n in
the KeyEventInventory directory to open the application.
c) Adding the KeyDown event handler for the first TextBox. Use the Class Name and Method Name ComboBoxes to add an empty KeyDown event handler for the Cartonsper shipment: TextBox.
d) Adding a Select Case statement. Add a Sel ect Case statement to the KeyDown
event handler that uses the Keys enumeration to determine whether a number key, aleft or right arrow, Enter or the Backspace key was pressed.
e) Adding the Case Else statement. Add a Case El se statement that executes when a key other than a valid one for this application was pressed. If an invalid key was pressed, clear the TextBox and display a MessageBox that instructs the user to enter a number.
f) Adding the KeyDown event handler for the second TextBox. Repeat Steps c-e, but this time create a KeyDown event handler for the Items per carton: TextBox. This event handler should have the same functionality as the one for the Cartons per shipment: TextBox.
g) Running the application. Select Debug > Start Debugging to run your application.
Try entering letters or pressing the up- and down-arrow keys in the TextBoxes. A
MessageBox should be displayed. Enter valid input and click the Calculate Total
Button. Verify that the correct output is displayed.
h) Closing the application. Close your running application by clicking its close box.
i) Closing the IDE. Close the Visual Basic IDE by clicking its close box.© BrainMass Inc. brainmass.com October 10, 2019, 6:12 am ad1c9bdddf
The solution discusses the visual basic regarding inventory application with keyboard events.