BMIS 208 Programming Assignment 8 Inventory Control
Write a menu-driven Visual Basic program for a bookstore to show the book inventory that is saved in a text file. Each record of the text file consists of five fields – title, author, category, wholesale price, and number in stock. (The two categories are fiction and non-fiction, represented by “F” and “N” in the file.) When the application opens, the program should display all of this data in a datagridview control. The user should have the option of sorting the data in ascending order or descending order by title. The menu item File contains the second-level menu item Exit, which exits the application. The menu item Sort contains the two second-level menu items Ascending and Descending. The menu item Filter contains the three second-level menu items All Books, Fiction Books and Non-Fiction Books.
[Note: You should make the first column containing the book title large enough to display the entire title of each book. To do this, set the AutoSizeColumnsMode property to “All Cells”.]
1. The text file, Books.txt is included in your Instructions folder and should be stored in your project’s bin\debug folder.
2. Read the values of the text file into an array called bookarray.
3. Use LINQ queries to separate the lines of the text file into their own fields called Title, Author, Category, Stock, and Price and display these values in a datagridview control. You will find it useful to set the datasource property of the datagridview control to the results of your LINQ query.
4. When the user clicks on the Sort menu, use LINQ queries to sort the array in ascending or descending order by Title and re-display your results in the same datagridview control. Make sure that only one option under the Sort menu appears checked at any given time.
5. When the user clicks on the Filter menu, use LINQ queries to filter the array by fiction, non-fiction, or all books. Note that you will need to use the letters “F” or “N” to filter the books based on the category listed in the text file. Make sure that only one option under the Filter menu appears checked at any given time.
6. Preserve the selections from the Sort and Filter menus in your results. That is, if the user has selected to Filter the list to Non-fiction books and then clicks Sort | Descending, the datagridview control should display the list of non-fiction books, sorted in descending order.
7. The form should open with the Sort | Ascending and Filter | All Books options set. The datagridview control should display these results as well.
8. Ensure that the full title can be seen for every row.
9. Include shortcuts and access keys for each menu item (such as Ctrl-X for Exit, Ctrl-A for Ascending, etc.)
As in all of your assignments, make sure that you have used appropriate programming techniques (i.e. naming of controls and variables, form has a title, internal documentation/comments are clear, formatting of any currency fields, etc.)