dejandejanovic
asked on
Trying to SUM listbox items, but getting "Conversion from type 'ListItem' to type 'String' is not valid". Need someone to check code.
Hello,
can someone please advise what I'm doing wrong. I have try many solutions, but just cannot get out from error like:
"Conversion from type 'ListItem' to type 'String' is not valid", or
Conversion from type 'ListItem' to type 'Double' is not valid, or
Conversion from type 'ListItem' to type 'Integer' is not valid, etc
Thanks in advance for hlep!
can someone please advise what I'm doing wrong. I have try many solutions, but just cannot get out from error like:
"Conversion from type 'ListItem' to type 'String' is not valid", or
Conversion from type 'ListItem' to type 'Double' is not valid, or
Conversion from type 'ListItem' to type 'Integer' is not valid, etc
Dim result As Double = Math.Round((TextBoxA.Text + TextBoxB.Text, 1)
MsgBox(result)
Dim Pcs As String = result * TextBoxC.Text
MsgBox(Pcs)
ListBox1.Items.Add(Pcs)
Dim sum As Double
For Each item As String In ListBox1.Items
sum += Double.Parse(item)
Next
Thanks in advance for hlep!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works perfect! Thanks.
Open in new window