Results 1 to 3 of 3

Thread: [resolved]Use anything that has .caption

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    343

    Resolved [resolved]Use anything that has .caption

    Hello, I was wondering, I have a function and I want the user to enter a control they have (label, form, commandbutton, anything that can do .caption). But I don't know how I can do this...

    Module:
    vb Code:
    1. Option Explicit
    2.  
    3. Dim i As Integer
    4. Dim Start As Long
    5. Dim EndT As Long
    6. Dim Total As Double
    7. Dim DoTime As Integer
    8.    
    9. Declare Function GetTickCount Lib "kernel32" () As Long
    10.  
    11. Public Function TimerStart(Optional Lbl As Label, _
    12. Optional Cmd As CommandButton, _
    13. Optional Frm As Form) As Long
    14.  
    15.     i = i + 1
    16.        
    17.     If i = 1 Then
    18.         Start = GetTickCount
    19.     End If
    20.        
    21.     EndT = GetTickCount
    22.     Total = (EndT - Start) / 1000
    23.  
    24.         Cmd.Caption = Total
    25.  
    26.         Lbl.Caption = Total
    27.  
    28.         Frm.Caption = Total
    29.  
    30. End Function
    31.  
    32. Public Function TimerReset()
    33.     i = 0
    34. End Function
    Basically my question is.. how can I get cmd.caption=total, lbl.caption=total etc. into just one. Example: obj.caption=total. Thanks.
    I wasn't quiet sure how to ask this, I hope it wasn't too confusing.
    Last edited by bluehairman; Mar 22nd, 2008 at 06:14 PM.

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