C# Write a program that displays a graphical user interface (Windows form) that
ID: 3741587 • Letter: C
Question
C#
Write a program that displays a graphical user interface (Windows form) that allows multiple names, e-mail addresses, and local phone numbers to be entered. Allow only numbers to be entered for the phone number. Retrieve and store the values entered by the user in a text file and then ready the GUI for the next set of input values. Store each person’s data on separate lines. Include appropriate exception-handling techniques in your solution. When the application closes, locate the text file and verify its contents.
Explanation / Answer
Please find my implementation:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Sample_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCreate_Click(object sender, EventArgs e)
{
SaveFileDialog file = new SaveFileDialog();
file.FileName = "data.txt";
file.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
file.ShowDialog();
StreamWriter filewrite = new StreamWriter(file.FileName);
}
private void btnSave_Click(object sender, EventArgs e)
{
TextWriter file = new TextWriter
}
private void btnClear_Click(object sender, EventArgs e)
{
txtName.Clear();
txtEmail.Clear();
txtPhone.Clear();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.