Reputation: 3
Hi i need to validate a text-box input throw a .dat file[plain text] if it matches it do other stuff and if not i displays a pop up message
any help would be appreciated
and if you can also tell me how to encrypt that .dat file to more secure
Thank you
Upvotes: 0
Views: 2221
Reputation: 4247
Try something like this:
// read file content into a string
String fileContent = System.IO.File.ReadAllText(@"c:\file.dat");
// compare TextBox content with file content
if (fileContent.Equals(myTextBox.Text))
{
// do something
}
else
{
MessageBox.Show("Error!");
}
Upvotes: 2
Reputation: 30922
Take a look at StreamReader, that will allow you to read the file into your app.
Upvotes: 0