PDA

View Full Version : Solved: summed one, two or more textboxes in mathematical way



white_flag
11-22-2010, 07:51 AM
Hello, I need your help.

I have the following: 2 textboxes to be summed and displayed in an Label text. I put the following code (but it is not working):

For i = 1 To 5
If Me.Controls("CheckBox" & i) = True Then
Formula = Formula + CDbl(CDbl(Me.Controls("TextBox" & i).Text) & "*(1+" & CDbl(Me.Controls("TextBox" & i + 1).Text) & "/100)")
Me.Controls("Label" & i + 38).Caption = Formula_A
End If
Next


then I cut the "CDbl"


For i = 1 To 5
If Me.Controls("CheckBox" & i) = True Then
Formula = Formula + CDbl(Me.Controls("TextBox" & i).Text) & "*(1+" & CDbl(Me.Controls("TextBox" & i + 1).Text) & "/100)"
Me.Controls("Label" & i + 38).Caption = Formula_A
End If
Next


the result is: I have the formula displayed in an label text but not solved (ex. 10*(1+10/100))-so it is like an text. Can be solved mathematically?

thx for input

Bob Phillips
11-22-2010, 08:35 AM
Something along these lines



Label1.Caption = Application.Evaluate(TextBox1.Text & TextBox2.Text

white_flag
11-23-2010, 02:06 AM
xld, thx :)

Bob Phillips
11-23-2010, 02:58 AM
Glad to help. I will be in Belgium early Dec, I am attending a SQL Conference in Antwerp.

white_flag
11-23-2010, 04:16 AM
nice :), If you are not busy, I can show you the city..

Bob Phillips
11-23-2010, 04:47 AM
Do you live in Antwerp?

I am in San Marco Village for the conference on the 2nd, then on Fri 3rd I am free for a bit of sight-seeing. I hear it is a lovely city.

white_flag
11-23-2010, 05:04 AM
I am living around Antwerpen (20 km), so, will not gone be an problem to show a bit from city. If the weather will be nice, that will be great. San Marco Village is in Wilrijk not so far away, so, I can pick you up. just send me in pm your mobile. :)