Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

everyone. I need a help for this error which is (input string was not in the cor

ID: 3803077 • Letter: E

Question

everyone. I need a help for this error which is (input string was not in the correct format). I am trying to save the selected check box changes when click on the button save, and this is my code: C# code

protected void btnSaveLegalEventSelect_Click(object sender, EventArgs e)

{

string[] listDebtorNumber = ((string)Session["legalEvents_debtorNumber"]).Split(',');

string[] listClientCode = ((string)Session["legalEvents_clientCode"]).Split(',');

for (int i = 0; i < listDebtorNumber.Length; i++)

{

SaveRecord(Int32.TryParse(listDebtorNumber[i]), listClientCode[i], eSaveType.single); // error Exception here (input string was not in correct format)

}

}

Explanation / Answer

you are trying to parse a string which is not in number format like

Int32.TryParse("test")

in the above code "test" is a alphabetical format so it give exception

listDebtorNumber[i] has invalid number format.

Try to use deguber and check the value in it.