I would like to show messages for each value of an array : dataArr is an list of a structure, inside that there is an empty array which will fill with the int values like 1, 2 ... 9.
My current code C#:
for ( int i = 0; i < dataArr.Count - 1; i++ )
{
if ( dataArr[i]._errors != null && dataarr[i]._errors.Length > 0 )
{
if ( dataArr[i]._errors[0] == 1 )
{
MessageBox.Show("Error1");
}
if ( dataArr[i]._errors[0] == 2 )
{
MessageBox.Show("Error2");
}
if ( dataArr[i]._errors[0] == 3 )
{
MessageBox.Show("Error3");
}
... till...
if ( dataArr[i]._errors[0] == 9 )
{
MessageBox.Show("Error9");
}
}
}
In debug I have received random received values like this: dataArr[i]._errors[0] = 2, dataArr[i]._errors[1] = 5 like this,any specific values can be come from a enum (1...9).
My question is how can I show messages for each values which I will receive randomly from that enum, like above in my if statement. Can I use if statement or switch statement.
When I debug, I get values in _error field like _error[0] = 2, _error[1] = 5, like this because there are 2 errors currently, Numbers 1 to 9 are error codes stored in my enum. DataArr is a list of a structure contains this array _errors[]. I would like to show specific error messages using messagebox for values received in array.
I appreciate your help ☺️
Aucun commentaire:
Enregistrer un commentaire