i have created a login form using c# Windows form & i am saving username or password to a text file by submiting login form.
but what i want is:- when i click in my textbox it should show the all saved username or password to choose(username or password) that i have saved so i don’t have to insert the same username or password again.
what i want is like this: http://i49.tinypic.com/rkuats.jpg and http://i46.tinypic.com/21edys1.jpg
and this is my code:
private void button1_Click(object sender, EventArgs e)
{
try
{
FileStream fs = new FileStream("data.txt", FileMode.Append,
FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.Write("Email ID: ");
sw.WriteLine(textBox1.Text);
sw.Write("Password: ");
sw.Write(textBox2.Text);
sw.WriteLine();
sw.WriteLine();
sw.Flush();
sw.Close();
fs.Close();
}
catch (Exception)
{
MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
MessageBox.Show("Login Complited", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
textBox1.Clear();
textBox2.Clear();
}
Sounds like what you want is AutoComplete. Check out this link on C Sharp Corner to see how to enable auto complete