Catch bad file, invalid csv, etc.
This commit is contained in:
parent
405fe94953
commit
f749914338
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user