Hi Guys, I have this code:
And this bit too
They should be producing an Endbal for me. but this is the result i get when i enter Startbal: 100.00 income: 10.00 Budget: 5.00 Expense: 2.50:
82.50
it should be 102.50
I have seperated out the individual results in the msgboxes and found them to be like this:
Startbal: 100.00, Income: 10.00 Budget: 15.00 Expense: 12.50
It seems to be adding a 1 in front of my budget and expense
Please help... i know this is probably something very simple and i havn't looked properly... but it is pissing me off lol
Code:
Sub Btn_Cntrl(sender As Object, e As EventArgs) Handles Button2.Click, Button3.Click, Button4.Click
Dim Btn As Button = DirectCast(sender, Button)
Select Case Btn.Name
Case Is = "Button2"
Income = 0
ListBox1.Items.Add(InputBox("Enter Income Amount:" & vbCrLf & "Example: 24.99", "Income amount", "0.00"))
For I = 0 To ListBox1.Items.Count - 1
Income = CDec(Income + CDbl(ListBox1.Items(I).ToString))
Next
Case Is = "Button3"
Budget = 0
ListBox2.Items.Add(InputBox("Enter Budget Amount:" & vbCrLf & "Example: 24.99", "Budget amount", "0.00"))
For I = 0 To ListBox2.Items.Count - 1
Budget = CDec(Income + CDbl(ListBox2.Items(I).ToString))
Next
Case Is = "Button4"
Expense = 0
ListBox3.Items.Add(InputBox("Enter Expense Amount:" & vbCrLf & "Example: 24.99", "Expense amount", "0.00"))
For I = 0 To ListBox3.Items.Count - 1
Expense = CDec(Income + CDbl(ListBox3.Items(I).ToString))
Next
End Select
End SubCode:
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
If Me.Height = 20 Then
Setup_Listboxes()
Setup_Buttons()
Me.Size = New Size(Me.Width, (Label2.Height + ListBox1.Height + Button2.Height))
Else
Me.Height = 20
EndBal = (StartBal + Income) - (Budget + Expense)
MsgBox(StartBal & " - " & Income & " - " & Budget & " - " & Expense & " - " & EndBal)
MsgBox(StartBal + Income)
MsgBox(Budget + Expense)
Label5.Text = CStr(EndBal)
End If
End Sub82.50
it should be 102.50
I have seperated out the individual results in the msgboxes and found them to be like this:
Startbal: 100.00, Income: 10.00 Budget: 15.00 Expense: 12.50
It seems to be adding a 1 in front of my budget and expense
Please help... i know this is probably something very simple and i havn't looked properly... but it is pissing me off lol