I’m currently trying to use an if statement to read to see if a txt file in a folder named Accounts and determine whether that file exists, if it does then it opens up the next window, and if it doesn’t, then the user gets a response saying account does not exist! Here is the code I have
String FilePath = UsernameTextBox.Text;
if(File.Exists(FilePath)
{
Welcome openForm = new Welcome();
openForm.Show();
}
Else
{
MessageBox.Show(“Account Does Not Exist”)
}
It kind of works meaning that if i put the full path into the text box with the extension .txt it opens the next window but I want to be able to just put the FileName in eg HarrySmith and for it to read and open the new window! Thanks in advance