Results 1 to 7 of 7

Thread: Coding Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    16

    Coding Problem

    I am making a code to calculate the total change from cash entered when I click the calculate button, I also need the number of 20s and 10 and 5s given back put in the label next to the corresponding number.

    My code looks like



    Private Sub btnCalculate_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnCalculate.Click
    'declare local variables
    Dim lblTwenty As Integer


    End Sub

    But it says intTwenty is an undeclared local variable when I named the label box next to 20 "lblTwenty"???

  2. #2
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Coding Problem

    This is VB.NET, next time post here: http://www.vbforums.com/forumdisplay.php?f=25

    Also:

    Private Sub btnCalculate_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnCalculate.Click
    'declare local variables
    Dim lblTwenty As Integer

    You are dimming lblTwenty as an integer.

    Should be:

    Dim intTwenty As Integer

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    16

    Re: Coding Problem

    I did that, but it says intTwenty is an unused variable???

  4. #4
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Coding Problem

    Well you haven't used intTwenty anywhere.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    16

    Re: Coding Problem

    I put it as the name of the label $20, as in intTwenty?

    Where would I use intTwenty on the interface?????

  6. #6
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Coding Problem

    I've responded to your PM.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Coding Problem

    Please do not create duplicate threads - this thread is now closed.

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