Ask Experts Questions for FREE Help !
Ask
    Mina Zaki's Avatar
    Mina Zaki Posts: 6, Reputation: 1
    New Member
     
    #1

    Mar 28, 2008, 03:06 PM
    My wrong calculator code.
    i did a very simple calculator




    And this is my code




    And this is the problem when i tried it.......







    [CENTER]
    what is the wrong?????

    please i need your help!!!!!![/
    CENTER]:mad:
    Username Here's Avatar
    Username Here Posts: 72, Reputation: 2
    Junior Member
     
    #2

    Mar 29, 2008, 10:18 AM
    Try "Else If"

    I haven't done VB in a while, but I can't remember weather it will allow more than one if statement per private sub. If not try making A and B integers. Correct syntax means that "Text3.Text = A + B" should have its own line, but it's a single line If statement so it may not affect it.

    sorry I couldn't be of much help, I haven't done VB in a while. I'm a C# nerd atm.
    Louis
    kabia's Avatar
    kabia Posts: 9, Reputation: 2
    New Member
     
    #3

    Apr 3, 2008, 11:46 PM
    If you put :

    "If Option1.value = true then Text3.text = A + B"

    On one line...
    You do not need to put the "end if" statement

    But to correct your issue...

    Private Sub Command1_Click()
    Dim A, B
    A = Val(Text1.text)
    B = Val(text2.text)
    If Option1.value = true then
    Text3.text = A + B
    end if
    If Option2.value = true then
    Text3.text = A - B
    end if
    If Option3.value = true then
    Text3.text = A * B
    end if
    If Option4.value = true then
    Text3.text = A / B
    end if

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Vb 6.0 calculator [ 2 Answers ]

Please help me! On my prject , I need a source code of a vb 6.0 calculator please help. Tnx

TI-84 Plus Calculator [ 1 Answers ]

This is sort of a math question and it isn't. I just bought this calculator yesterday, and the book that came with it does not tell me how to program the Quadratic formula as well as other equations into this calculator. And someone I know in my class has the same one and told me that this can be...

Wrong XP code [ 1 Answers ]

I have entered the code when installing an upgrade from windows Home to professional but it is not being accepted. How can I check that the code I am inputting is OK, and if not how can I fix the problem

How to do e-0.05 on a calculator [ 5 Answers ]

Hi there, What are the exact steps I press on a calculator to do the following: - 40e-0.05 I keep getting the wrong answer? Any help is appreciated


View more questions Search