hi can anyone help me about my problem how can i come up w/ this solution for example

1 + 2.00

the answer should

3.00

or like this 1.35+2.00

the answer should

3.35

how can i do this?

Recommended Answers

All 7 Replies

MsgBox CDbl(1 + 3.3)

hi comatose i have 2 textbox 1 is text3 and the second is text4 and i have also 1 label in may label1 the caption is "00.00" all i want is everytime i click my command button for example if i input in the text 3 3.75 and text4 is 2 the label1.caption should come up w/ this answer 5.75.

You can't take what is above and modify it for your needs?

label1.caption = CDbl(text3.text + text4.text)

Hello try this, for example the name of your command button is "cmdadd"

Private Sub cmdadd_Click()
Dim ans
ans=val(text3.Text) + val(text4.text)
label1.Caption=ans
End Sub

or

Private Sub cmdadd_Click()
label1.Caption=val(text3.Text) + val(text4.text)
End Sub

comatose the answer dont have a decimal .00 its only 2 it should 2.00

one of the textboxes needs to have the decimal point in it.... in text3 type in 2, in text 4 type in 3.3... now what?

In order to make it work with zeros, you need to look at "format" or format$

Hi,

Try This :

Text3.Text = Format(Val(Text1.Text)+Val(Text2.Text), "0.00")

Regards
Veena

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.