Results 1 to 7 of 7

Thread: Visual Basic 6 [Adding/Linking Boxes Together]

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    4

    Visual Basic 6 [Adding/Linking Boxes Together]

    http://www.uploading.com/files/V2RQ8...Files.rar.html



    Here are my files, baically i have made everything ok but i don't know much about the coding... where the boxes are i would like to put numbers in them (there are 12) and then the box near the bottom would then be linked to those 12 boxes so then it finds the total amount.

    and the next box under "total" would then subtract/add the total amount and then display it in the box.

    i'm a complete newb at VB and i was wondering if anyone could help me (your my last chance)

    i would be very very happy if someone could make me the code so then i can use it in my boxes, i only require this as this is the problem i'm having (i'm in a IT Course ATM learning in college about this).
    Last edited by Ghostman1; Sep 16th, 2007 at 07:01 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Visual Basic 6 [Adding/Linking Boxes Together]

    Are these standalone textboxs (non-arrayed) or are they in a control array?

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    4

    Re: Visual Basic 6 [Adding/Linking Boxes Together]

    I think there in a controlled array because i copyed and pasted them to make them the same size and it said something about that.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Visual Basic 6 [Adding/Linking Boxes Together]

    Click on them individual and look at the property page.

    If they all have the same name, they are in a control array.

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    4

    Re: Visual Basic 6 [Adding/Linking Boxes Together]

    Yea, they all have the same name it's a control array.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Visual Basic 6 [Adding/Linking Boxes Together]

    Try this
    Code:
    Private Sub Command1_Click()
      Text4.Text = Val(Text1(0).Text) _
      + Val(Text1(1).Text) _
      + Val(Text1(2).Text) _
      + Val(Text1(3).Text) _
      + Val(Text1(4).Text) _
      + Val(Text1(4).Text) _
      + Val(Text1(6).Text) _
      + Val(Text1(7).Text) _
      + Val(Text1(8).Text) _
      + Val(Text1(9).Text) _
      + Val(Text1(10).Text) _
      + Val(Text1(11).Text)
    End Sub

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    4

    Re: Visual Basic 6 [Adding/Linking Boxes Together]

    Code:
    Private Sub btnCalculate_Click()
            EnterAmountHere0 = CInt(txtInputs(2).Text)
            EnterAmountHere0 = CInt(txtInputs(3).Text)
            EnterAmountHere0 = CInt(txtInputs(4).Text)
            EnterAmountHere0 = CInt(txtInputs(5).Text)
            EnterAmountHere0 = CInt(txtInputs(6).Text)
            EnterAmountHere0 = CInt(txtInputs(7).Text)
            EnterAmountHere0 = CInt(txtInputs(8).Text)
            EnterAmountHere0 = CInt(txtInputs(9).Text)
            EnterAmountHere0 = CInt(txtInputs(10).Text)
            EnterAmountHere0 = CInt(txtInputs(11).Text)
            EnterAmountHere0 = CInt(txtInputs(12).Text)
            EnterAmountHere0 = CInt(txtInputs(13).Text)
            EnterAmountHere0 = CInt(txtInputs(14).Text)
            txttotal(0).Text = EnterAmountHere0
    End Sub
    Ok, i tryed making my own and i seem to get the last one to work but the rest don't want to work... the "EnterAmountHere0" is the text, in the name which is "txtInputs" and the "txttotal(0).Text" is the Total Amount box which is suppose to contain "EnterAmountHere0" as in all of them not just the last one, i'll try your thing in a different box and tell you if it works.

    P.S there suppose to Add (i tryed the + before the EnterAmountHere0 but it gave me an error).

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