Input string was not in a correct format

P

Phinney

Hi;

I got the following error message:

An unhandled exception of type 'System.FormatException' occurred in
mscorlib.dll
Additional information: Input string was not in a correct format.

Here is some of the local code:
For pintcount2 = 0 To payrollFiles.GetUpperBound(0)
If cboSelectEmployee.Text = payrollFiles(pintcount2).sourcePayID.ToString
Then
pstr2 = payrollFiles(pintcount2)
lstDate.Items.Add(pstr2.sourceDate.ToShortDateString)
lstGross.Items.Add(pstr2.sourceGross.ToString("c"))
lstWithholding.Items.Add(pstr2.sourceWithhold.ToString("c"))
lstFica.Items.Add(pstr2.sourceFica.ToString("c"))
lstNetPay.Items.Add(pstr2.sourceNet.ToString("c"))
End If
Next

For pintcount2 = 0 To lstGross.Items.Count - 1
pintgross += ToInt32(lstGross.Items(pintcount2)) <- error message was
highlighted here.
Next
lblGrossTotal.Text = pintgross.ToString("c")

Any suggestions
Thanks in advance
 
C

Cor Ligthert [MVP]

Phinney,

I don't know if this sentence is inside a With, otherwise it is probably
pintgross += ToInt32(lstGross.Items(pintcount2)) <- error message was

pintgross += CInt(lstGross.Items(pintcount2))

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top