I had a project in which I had to make almost the same.
In the following example, a text file is used as database and a
textbox1
is the main textbox.
if(textBox1.Text == File.ReadAllLines(@"C:/database.txt")
{
MessageBox.Show("One match found: " + textBox1.Text);
}else
{
MessageBox.Show("No match found! Added to database instead.");
StreamWriter sw = new StreamWriter(@"C:/database.txt");
sw.WriteLine(textBox1.Text);
sw.Close();
}
Hope this helps! Cheers - CCB