Results 1 to 7 of 7

Thread: HELP me please with this programme i am a novice

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    15

    HELP me please with this programme i am a novice

    VB Code:
    1. Windows Form generated code

    Dim strNumber As String
    Dim decNum1 As Decimal
    Dim decNum2 As Decimal
    Dim chrOperator As Char
    Dim decAnswer As Decimal

    VB Code:
    1. Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click, btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, btndecimal.Click

    strNumber = strNumber & sender.text
    lblanswer.Text = strNumber
    End Sub

    VB Code:
    1. Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click

    If sender.text = "=" Then
    decNum2 = strNumber

    'work out your answer here and display it in the label.
    'Put the answer into decnum1
    i think this is right?
    Else
    decNum1 = strNumber
    chrOperator = sender.text
    End If
    strNumber = ""
    End Sub

    VB Code:
    1. Private Sub btnequals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnequals.Click

    If sender.text = "=" Then
    lblanswer.Text = decAnswer
    End If
    End Sub
    End Class



    ok thats all the code i have i need to work out that middle bit in bold could anyone clear this up for me or give me the code to simple similar calculator program thank you for helping

  2. #2
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Re: HELP me please with this programme i am a novice

    first of all you need to have a more specific description of your problem in the forum. "help me I dont know what I am doing" is terrible. is this a homework assignment?

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    15

    Re: HELP me please with this programme i am a novice

    Please HELP ME !!!!!!!!!!

  4. #4
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: HELP me please with this programme i am a novice

    VB Code:
    1. Windows Form generated code
    2.  
    3.     Dim strNumber As String
    4.     Dim decNum1 As Decimal
    5.     Dim decNum2 As Decimal
    6.     Dim chrOperator As Char
    7.     Dim decAnswer As Decimal
    VB Code:
    1. Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click, _
    2. btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, btndecimal.Click
    3.    lblAnswer.Text = Nothing
    4.    if chrOperator = Nothing then
    5.       decNum1 = sender.text
    6.    else
    7.       decNum2 = sender.text
    8.    end if
    9.     End Sub
    VB Code:
    1. Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
    2.        
    3.    chrOperator = "+"
    4.     End Sub
    VB Code:
    1. Private Sub btnequals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnequals.Click
    2.        
    3.    Select Case chrOperator
    4.    Case "+"
    5.       lblAnswer.Text = decNum1 + decNum2
    6.    End Select
    7.    decNum1 = Nothing
    8.    decNum2 = Nothing
    9.    chrOperator = Nothing
    10.     End Sub
    11. End Class

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    15

    Re: HELP me please with this programme i am a novice

    well thanks for those that helped and no it wasnt a homework assignment it is for a business website that im creating anyway that shouldnt matter geez

  6. #6
    Addicted Member
    Join Date
    May 2005
    Posts
    162

    Re: HELP me please with this programme i am a novice

    Don't get ants in the pants, you need to help us help you. help us help you that's all.

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    15

    Re: HELP me please with this programme i am a novice

    im sorry but i am beyond help i dont know anything about vb.net (i want to and try) i cannot explain something i dont understand

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width