hey guys

quick one, im doing an income vs expenses form on VB, i have two mulitline textboxes, one for income and one for expenses. Everything works well but i dont know how to add up the numbers in the textboxes when i have say 5 incomes, in the income box, each on a new line and 3 expeneses, each on a new line on the expeneses textbox. i am using a button to do the calculation and output of profit/loss is in a message box. PLease assit

Recommended Answers

All 3 Replies

How about

Dim total As Single = 0.0

For Each line As String In TextBox1.Lines
    If IsNumeric(line) Then
        total += CSng(line)
    End If
Next

thank you i shall try this and let you know... will also post my code once ive added your lines

great thank you so much it works perfectly, your help is much appreciated

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.