|
|
The Visual Basic Index. | Main Page ~ Sign Guestbook ~ View Guestbook | ||||||||||||
|
|
||||||||||||||
|
Summery of tutorials Introduction to VB Lesson one Lesson Quiz Lesson two Lesson three Lesson four
VB Books + Selected Cheap UK books Fix word documents Domestic energy assessor |
Below are a selection of collage exam papers that you are lickly to take if you live in North America the following paper is taken from a years study on a cource so if you can do any of this before this time then you have notthing to worry about. If you deside to take the real thing.
FILES REQUIRED Cust1.txt and States.txt GENERAL:Whenever a file is being read, sorted or written, change the Screen.MousePointer = vbHourglass so that the user will know that something is happening. Change it to Screen.MousePointer = vbDefault when the user can interact with the program again. Center all forms on the screen using a procedure in the module. (see "Centering Forms on the Screen in the virtual conference). Only read the customer file once at the beginning of the program and write it (only if any changes were made) once at the end of the program. All work on customers will be done in a customer array. Failure to use an array will result in a failing project grade. MODULE: Create a global variable for passing the customer number between forms, create a global variable to track whether or not nay changes were made to customer records, and create a global variable to track the current number of records in the customer array. Also, create a public two-dimensional dynamic array to store customer information. The array should have the data fields as rows and each customer as a column as shown below. You will re-dimension the array later.
Develop a form like the one shown below:
![]() Form Activate: Load the customer array from the file. Re-dimension the array's columns to the actual number of customers in the file. Sort the array by customer number. Hint: To save coding, you could write one sorting routine in the module that is called by both forms and passes the sorting technique. The customer information frame should be invisible. Only the customer number textbox should be usable. Menu and ToolBar Design: The main menu should have two choices-Customer and Quit. Quit should terminate the application. The Customer menu should have a submenu including Add, Change, Delete, Separator Bar, and Lookup. The toolbar should have buttons for Add, Change, Delete, Lookup, and Quit. Select appropriate icons to place in an imagelist for use with the toolbar (remember to save all of your icons on you submission disk). The menu and toolbar function exactly the same way and should use the same code-not copied, but the same code. Use tool-tip-text to describe the function of each of the buttons on the toolbar. Customer Number Textbox: Only allow entry of five numbers. The user must enter a customer number before they can continue. Use a message box to display any errors. The user should be allowed to select a customer from the list instead of entering it in the textbox using the Lookup button or selecting Lookup from the menu. If the user selects a valid customer from the list, display the customer number selected and disable the textbox. Customer Information Frame: Place the indicated textboxes on the customer frame in a single control array. Place a slider control on the frame for the credit rating. If you are using the Professional or Enterprise Edition you will have a slider control. The CE Edition in the textbook does not have a slider control and will have to make alternative arrangements. Set both the large and small change for the slider equal to one. The label above the slider should indicate the customer's credit rating (1-Poor, 2-Weak, 3-Average, 4-Good, 5-Excellent). The two command buttons on the frame change depending on the action being taken. See Add, Change, and Delete below. The state combobox should work the same way it did in Project 3 (see Project 3 instructions and the virtual conference discussion). Do not allow the user to select anything from the menu or tool bar while they are adding, changing or deleting a record. Anytime you Add or Delete a record from the customer array, remember it may need to be re-dimensioned. Add: Customer numbers are assigned in sequential order starting at 100001. If the user selects Add, compute the next available customer number from the customer array and place it in the customer number textbox. Diasble the customer number textbox and display the blank textboxes in the customer information frame. Set the default credit rating to average. The first command button on the frame should say "Add." The second command button should say "Do Not Add". All controls in the customer information frame should be usable. Allow the user to add all information shown. When the user is done, they will press the Add command button. At this point, check that all fields are complete and update the array with the new customer's information and resort the array in customer number order. If the user selects the Do Not Add button, do not add the customer, make the customer frame invisible, clear out the customer number textbox and put the cursor on it. Change: The user must have a valid customer number before proceeding with this function. Disable the customer number textbox. Display the customer's information in the customer information frame. The first command button on the frame should say "Change." The second command button should say "Do Not Change". All controls in the customer information frame should be usable. Allow the user to update all information shown. When the user is done, they will press the Change command button. At this point, check that all fields are complete and update the customer's record in the customer array. If the user selects the Do Not Change button, do not change any customer information, make the customer frame invisible, clear out the customer number textbox and put the cursor on it. Delete: The user must have a valid customer number before proceeding with this function. Disable the customer number textbox. Display the customer's information in the customer information frame. The first command button on the frame should say "Delete." All controls in the customer information frame should be disabled, except the two command buttons. When the user is done, they will press the Delete command button. At this point, display a message box asking the user if they really want to delete the record. If the answer is yes, delete the customer's record in the customer array, resort by customer number, and re-dimension the array. Otherwise, make the customer frame invisible, clear out the customer number textbox and put the cursor on it. If the user selects the Do Not Delete button, do not delete the customer record, make the customer frame invisible, clear out the customer number textbox and put the cursor on it. List: Bring up the Customer List form and allow the user to select a customer from the listbox. See instructions below. Quit: If no changes were made to customers, then simply terminate the program. Otherwise, sort the customer array in customer number order using your sort routine. Check if there is already a previous version of Customer.Old. If so, get rid of it. Rename the customer file to Customer.Old. Write out the new customer file as Customer.Txt then terminate the application. CUSTOMER LIST FORM Develop a form like the one shown below:
![]() Listbox for Customer: Place a listbox on the form which will be used to display customer number, last name, first name, city, and state from the customer array. The list box style should be set to 0-Standard (only one item can be selected) and it should be unsorted. Set the font for the listbox to Courier New for better alignment. By default, the customer array and the listbox should be sorted by customer number. Sort By Buttons: Place a control array of command buttons for sorting the listbox. By default, the customers are sorted in the customer array by customer number. Display the customers in this order in form activate and disable the CustNo button. If the user presses the LastName button, sort the array into last name order and redisplay the array in the listbox, disable the LastName button, and enable the CustNo button. If the user presses the State button, sort the array into state order and redisplay the array in the listbox, disable the State button, and enable the CustNo and LastName buttons. See GENERAL for instructions on how to use Screen.MousePointer. Selecting a Customer: If the user highlights a customer using a single-click and presses the Select button, capture the appropriate customer information from the array and display it on the main form. The same actions will happen if the user double-clicks on a customer in the listbox. Only write the code once for both of these events by calling the other event. For example, you can simulate pressing a command button by calling the click event procedure for the command button. If the user selects a valid customer, place the information on that customer in the customer information frame as described above. Quit Button: The Quit button should take you back to the main form with no customer selected. The main form should look like it does when the program is first loaded. Download the VB sourcecode here project4.zip Join the mailing list to recive updates and source code Click Here
|
|||||||||||||