Question Search Processing problem

kdwsn25

New member
Joined
Nov 17, 2012
Messages
4
Programming Experience
Beginner
Im having problems with the file search, file list and delete processes. I did not understand how to do it when it was explained to me. Fortunately i'm not the only one with this problem Can someone please explain how to do them. The whole program assignment is listed below.
This program is to give you the opportunity to create a sequential file, add records to the file, change a record’s content, search for a specific record, list the contents of the file, and delete a record from the file. You will be called on to use all the skills and understanding of VB program concepts developed during this class.


1. The initial input data for this program is given below. You are to use this data to create a new file named “INVENTORY.TXT”. The data is to be placed in the file as follows: Stock Number, Stock Price, Quantity on Hand. Each item should be on a separate line. This is the file you will use for the remainder of the program.


2. The Form you design should be titled appropriately. It should have at least 6 buttons, 1 text box, and 1 list box. The buttons are to be titled appropriately.


3. APPEND (ADD) A RECORD PROCESS.
a. This should be an interactive process developed using INPUT BOXES.
b. The process should allow the addition of any number of new records to the file.
c. The process should use a LOOPING procedure.
d. Display a message in the text box when the append (add) process is complete and give a count of the number of records added


4. RECORD CHANGE/UPDATE PROCESS:
a. This is to allow the user to update the PRICE of an item in the Inventory file. This will require you to do the following:
b. Use INPUT BOXes to get the Stock Number and New Price of the item to be changed
c. Take the necessary action to change the price
d. Place a message in the text box that the item price was changed. For Example: “The price for XR546 has been changed to $4.75” or “The price for XR546 was changed from $5.75 to $4.75”
e. Ensure that the UPDATED “INVENTORY.TXT” is in the DEBUG folder and any temporary file used in this process is deleted from the DEBUG folder
6. FILE SEARCH PROCESS:
This process should search the INVENTORY file and display, in the text box, the STOCK NUMBER, STOCK PRICE, QUANTITY ON HAND and TOTAL VALUE of the most costly item (the item with the highest price).


7. FILE LIST PROCESS:
a. This process is to display the contents of the INVENTORY file in the list box. You should have appropriate report and column heading titles.
b. The report is to have column that shows the total value of each inventory item. The total value of an inventory item is its price times quantity on hand (Price * QOH)
c. The report is to have a total line showing the total value of all inventory items.


8. RECORD DELETE PROCESS:
a. Use INPUT BOXes to get the Stock Number of the record to delete
b. Take the necessary action to delete the record
c. Place a message in the text box that the record has been deleted
d. Ensure that the UPDATED “INVENTORY.TXT” is in the DEBUG folder and any temporary file used in this process is deleted from the DEBUG folder


9. PROGAM EXIT PROCESS: End the program using an Output Message box.


REQUIRED RECORDSETS TO BE USED TO CREATE THE“INVENTORY.TXT” FILE
A12345
10.50
1000
B12345
1.50
10000
C12345
150.00
10
In addition tothe above record sets, add as many records as you want to the file.
 
Hi,

Having read through your assignment it sounds like one of the aspects of the solution is to effectively create and manage your own database solution using a flat file.

To start with then you need to look at reading and writing files. Look here:-

StreamReader Class (System.IO)
StreamWriter Class (System.IO)

You then need to look at creating a Structure or a Custom Type to store the information for your records. As part of this you then may want to think about incorporating Serialization into your solution:-

Serialization Guidelines

As for Adding and Deleting you could use a List(of T) to hold your records in a container. You can then use the Add method to add a new record and the Remove method to delete records. (Then writing back to the file).

As for searching your best bet would be to use LINQ to build structures that can then be used to search your list of records.

All the above however is dependant on the techniques you have learned so far in your course.

Hope that helps.

Cheers,

Ian
 
Back
Top