Write a Windows application that gets names and e-mail addresses from the user a
ID: 673640 • Letter: W
Question
Write a Windows application that gets names and e-mail addresses from the user and displays a list of all of the user's contacts
I am looking at the code that was posted previously see below. But you get an error that states that The type or namepace name 'Form1' could not be found (are you missing a using directive or an assembly reference? How do I correct this? Been trying for days.
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;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace AdressBook
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnAdd_Click(object sender, EventArgs e)
{
//Text writer to write data to text
//StreamWriter("data.txt", true) here true represents to append data
TextWriter write = new StreamWriter("data.txt", true);
//write data to the file
write.WriteLine(txtName.Text);
write.WriteLine(txtEmail.Text);
write.Close();//closing file
//open file for reading
TextReader reader = new StreamReader("data.txt");
string str;
//reading all lines of data from file
//adding to list box
lstContacts.Items.Clear();
while ((str = reader.ReadLine()) != null)
{
lstContacts.Items.Add(str);
lstContacts.Items.Add(reader.ReadLine());
lstContacts.Items.Add("");
}
reader.Close();//closing file
//clearing text boxes
txtName.Clear();
txtEmail.Clear();
}
}
}
Explanation / Answer
1. If you are running using command line
Point to the correct version of .Net framework
2. If your using Visual Studio
Try the following
1. Point to the correct version of .Net framework
or
1.remove all references
2.Build --> Clean solution
1.remove all references
2.Build --> Clean solution
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.