Results 1 to 4 of 4

Thread: Stupid Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    130

    Stupid Question

    This is a stupid question.....but I have put some code inside a text box which I want to make the contents of the text box change immediately depending one what else is happening on the form.

    Makes no sense? Heres the code, I know it must be so obvious...

    VB Code:
    1. Option Explicit
    2. Dim TOTAL As Double
    3. Dim LINES As Integer
    4.  
    5. Private Sub txttotal_Change()
    6. LINES = txtlines.Text
    7.  
    8.  
    9. If cmoperms.Text = "10p" Then
    10. TOTAL = ("0.10") * LINES
    11. End If
    12.  
    13.  
    14. txttotal.Text = TOTAL
    15. End Sub

    Im gonna hit myself when I find out the answer.....
    PJ

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Shouldn't put this code in the Change event of the other TextBoxes so that when THEY change, the contents of txtTotal will be updated?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Something like:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub txtLines_Change()
    4. Dim TOTAL As Double, LINES As Integer
    5.  
    6.   LINES = Val(txtLines.Text)
    7.   TOTAL = 0.1 * LINES
    8.  
    9.   txtTotal.Text = TOTAL
    10.  
    11.   'simplified version:
    12.   'txtTotal.Text = 0.1 * Val(txtLines.Text)
    13. End Sub
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    130
    Cheers mate.....
    PJ

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