Hello i need help with creating a Adressbook all information should be saved in a text file. This means that the application should be able to read and write from this text file. The following information should be able to be registered and saved to the text file: name, street address, postal code, city, phone, and email.It should be possible to save a new address in the address book, but also to update an address that already exists.It should be possible to remove an address, and it should then disappear from the address book.It should be possible to search for one or more addresses, and the search results should be displayed in a list.From the list, it should be possible to click on a row and get all the information about that address.
Loading
Jayraj ChhayaPosted Dec 28, 2023, 9:44 AM
To create an address book application in Windows Form, you can follow these steps:
Design the User Interface (UI): Start by designing the UI for your address book application. Use controls such as text boxes, labels, buttons, and a list view to display the address book entries.
Create a Text File: Create a text file to store the address book data. You can use a comma-separated values (CSV) format or any other format that suits your needs.
Read Data from the Text File: Implement a method to read data from the text file and populate the address book entries in the list view. You can use the
StreamReaderclass to read the text file line by line and split the data using the appropriate delimiter.Save Data to the Text File: Implement a method to save the address book data to the text file. You can use the
StreamWriterclass to write the data to the text file in the desired format.Add Address: Create a form or dialog to allow users to add a new address. Capture the necessary information such as name, street address, postal code, city, phone number, and email. When the user clicks the "Save" button, validate the input and add the address to the address book data structure. Finally, update the text file with the new address.
Update Address: Implement a functionality to update an existing address. Allow users to select an address from the list view and display the details in the respective text boxes. Users can modify the information and click the "Update" button to save the changes to the address book and update the text file.
Remove Address: Provide an option to remove an address from the address book. Users can select an address from the list view and click the "Remove" button to delete the address from the address book data structure and update the text file accordingly.
Search Address: Implement a search functionality to allow users to search for specific addresses. Users can enter a search query in a text box and click the "Search" button. Display the search results in the list view, highlighting the matching addresses.
Display Address Details: Enable users to click on a row in the list view to view the complete details of the selected address. Display the information in a separate form or dialog.
By following these steps, you can create a functional address book application in Windows Form that can read and write data from a text file. Remember to handle exceptions, validate user input, and provide a user-friendly interface for a seamless user experience.
Sam HobbsPosted Dec 27, 2023, 4:09 PM
Is this a class assignement? It sounds like a class assignment.
When you say a text file, the following are possibilities.
And there are others.
If this is not a class assignment then consider the possibilithy of multiple phone numbers and multiple email addresses. And if this is a class assignment then you might get extra credit for doing those. If you do then a format such as XML and JSON would have advantages.
Anandu G NathPosted Dec 27, 2023, 8:16 AM
@John Doe
Below is the best Answer
Sachin SinghPosted Oct 4, 2023, 8:04 AM
You can follow this article
https://www.codeproject.com/Articles/20908/C-Class-Text-file-as-DataBase