how can i say get textbox1 and textbox2 data to add up , or any variance as the user wishes . i have this so far
.
Expand|Select|Wrap|Line Numbers
- Function Total(ByVal ddeptprofit() As Double, ByVal ndept As Integer)
- Dim dtotal = 0
- Dim i As Integer
- For i = 0 To ndept - 1
- ddeptprofit(0) = CDbl(TextBox1.Text)
- dtotal = dtotal + ddeptprofit(i)
- Next
- Return dtotal
- End Function
- Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim ndept = 5
- Dim ddeptprofit(ndept) As Double
- ddeptprofit(0) = CDbl(TextBox1.Text)
- ddeptprofit(1) = CDbl(TextBox2.Text)
- ddeptprofit(2) = CDbl(TextBox3.Text)
- ddeptprofit(3) = CDbl(TextBox4.Text)
- ddeptprofit(4) = CDbl(TextBox5.Text)
- Dim dtotalprofit As Double
- dtotalprofit = Total(ddeptprofit, ndept)
- Label1.Text = "total is" & dtotalprofit.ToString