Does not work else statement. Please help me.
int countArmyNC = 0;
foreach (DataGridViewRow row in dataGridView1APen.Rows)
{
if (row.Cells[4].Value.ToString() == "‡mbv evwnbx (bb KwgkÛ)")
{
countArmyNC++;
}
else
{
countArmyNC = "";
}
}
Tapan PatelPosted Sep 1, 2017, 2:26 PM
Manikandan MurugesanPosted Sep 4, 2017, 9:03 PM
or better yet:
Also, since
Int32.TryParsereturns aboolyou can use its return value to make decisions about the results of the parsing attempt:If you are curious, the difference between
The TryParse method is like the Parse method, except the TryParse method does not throw an exception if the conversion fails. It eliminates the need to use exception handling to test for a FormatException in the event that s is invalid and cannot be successfully parsed.ParseandTryParseis best summed up like this:Hamid KhanPosted Sep 4, 2017, 6:13 AM
Puneet KankarPosted Sep 2, 2017, 4:51 AM
Hassan Uddin MughalPosted Sep 2, 2017, 1:27 AM
Ankit SharmaPosted Sep 1, 2017, 2:45 PM
Tapan PatelPosted Sep 1, 2017, 2:37 PM
Shovan SahaPosted Sep 1, 2017, 2:31 PM
Ankit SharmaPosted Sep 1, 2017, 2:26 PM