Question
Create an application with a class named Contacts. The Contacts class should have properties for FirstName (string), LastName (string), Address (string), City (string), State (string),
Create an application with a class named Contacts. The Contacts class should have properties for FirstName (string), LastName (string), Address (string), City (string), State (string), Zip (string), and Phone (string). Use the "Contacts.txt"(http://brucebauer.info/assets/IFSC1202/Contacts.txt) file as data for the application.
When the application starts, it should read the data from the file and create an a list containing an Contact object for each Contactss data. Rename the default Form1 to MainForm. The Lastname, FirstName of the list of Contacts objects should be displayed in a listbox on the applications MainForm. When the user selects a Name from the listbox, a modal second form named DetailForm should appear displaying that employees name, IDNumber, department, position, and an Exit Button. You will also create code to add, modify, delete, and save the Contacts List
Hint: To do this project, you will have to make your Contacts, Contact List, and selected index public so that code in the DetailForm and make changes. Use the following code
// Create List containing Retail Item Objects - Page 570 public static List contactlist = new List(); // Index of currently selected Retail Item (-1 means none selected) public static int selectedindex = -1;
and in the Contact Class
public class Contact
Requirements and Grading (100 points)
Contacts Object
(4) Contacts Constructor
(3) LastName Property
(3) FirstName Property
(3) Address Property
(3) City Property
(3) State Property
(3) Zip Property
(3) Phone Property
MainForm
During Form Load event:
(2) Reads a line from Contacts.txt
(2) Splits the line into an array
(2) Instantiates a Contacts object
(2) Adds the object to a list
(2) Adds LastName, FirstName to a listbox.
Close the contacts file
ListBox containing LastName, Firstname - when pressed:
(2) Sets the value of the selected index
(2) Instantiates a new DetailForm
(2) Sets each of the textboxes to the value of the Contact Properties using the selectedindex
(2) Shows the DetailForm
(2) When the DetailForm closes, clears the ListBox, loops through each of the Contact objects and displays the LastName, FirstName (in case there were changes)
Add Contact Button:
Set the selected index to -1
(2) Shows the DetailForm
(8) When the DetailForm closes, clears the ListBox, loops through each of the Contact objects and displays the LastName, FirstName (in case there were changes)
Save Changes and Exit Button:
(2) Loop though the Contacts List
(6) Concatatenate the FirstName, a comma, Lastname, a comma etc, for all of the properties in the Contact object
(2) Write the data to the contacts file
Close the contacts file
Close the MainForm
Exit Without Saving Button:
Close the MainForm
DetailForm
Save Contact Button:
Perform Edits on DetailForm InputsIf selectedindex = -1 then we are adding a new record.
(5) Instantiate a Contact object using the data on DetailForm
(5) Add the new Contact object to the list
If selectedindex != -1 then we are updatng an existing record.
(5) Update the Contact object in the list pointed to by selectedindex using data on the DetailForm
(5) Add the new Contact object to the list
Close MainForm
Delete Contact Button:
(5) Using the RemoveAt method, remove the Contact object in the list pointed to by selectedindex
Close DetailForm
Cancel Changes Button:
Close DetailForm
Edits on DetailForm Fields
(1) LastName
Must not be blank
Must be less than or equal to 25 characters
Force first character to uppercase
(1) FirstName
Must not be blank
Must be less than or equal to 25 characters
Force first character to uppercase
(1) Address
Must not be blank
Must be less than or equal to 25 characters
(1) City
Must not be blank
Must be less than or equal to 25 characters
Force first character to uppercase
(1) State
Must not be blank
Must be 2 characters
Force both characters to uppercase
(2) Zip
Must not be blank
Must be 5 digits
(3) Phone
Must not be blank
Must be 14 characters
Must be in the format (000) 000-0000
| Contacts Bauer,Bruce Smith,John Doe,Jane Save ChangesExit Without Add Contact and Exit | Contacts Bauer,Bruce Smith,John Doe,Jane Save ChangesExit Without Add Contact and ExitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started