Catch bad file, invalid csv, etc.

This commit is contained in:
Tim Young 2017-08-01 14:45:38 -05:00
parent 405fe94953
commit f749914338

View File

@ -414,6 +414,8 @@ namespace EduNetworkBuilder
//Now we have a csv file. Try to parse it
bool HadError = false;
try
{
using (TextFieldParser parser = new TextFieldParser(mydialog.FileName))
{
parser.TextFieldType = FieldType.Delimited;
@ -460,13 +462,18 @@ namespace EduNetworkBuilder
tList.Add(TStudent);
}
}
if(HadError)
if (HadError)
{
ShowInvalid("Username", InvalidUsers);
ShowInvalid("Full Name", InvalidFullName);
ShowInvalid("Password", InvalidPasswords);
}
}
catch (Exception except)
{
MessageBox.Show(except.ToString());
}
}
private void ShowInvalid(string What, List<string> BadUsers)
{