Originally posted by James Stanich
VB Code:
  1. ' In Declarartion Area
  2.  
  3. Dim BOOLCANCEL as Boolean
  4.  
  5. ' In Click Event of control you want to handle
  6.  
  7. If BOOLCANCEL = FALSE Then
  8.  
  9. ' Perform the click event...
  10.  
  11. ' When setting something you know will fire click event use :
  12.  
  13. BOOLCANCEL = TRUE
  14.  
  15. ' Run your code
  16.  
  17. BOOLCANCEL = FALSE

Does this make sense?
I agree with James I think this is the easiest and cleanest. I call my boolean varialble "ClickedByUser"

VB Code:
  1. Dim ClickedByUser as boolean
  2.  
  3. Sub Something()
  4.  
  5. 'Call the command1 click event
  6. ClickedByUser = False
  7. Command1_Click
  8.  
  9. End Sub
  10.  
  11. Sub Command1_Click()
  12.  
  13. 'see if user cliced me or program clicked me
  14. If ClickedByUser Then
  15.    'user code here
  16. Else
  17.    'program code here
  18.    
  19.    'reset my variable
  20.     ClickedByUser = True
  21. End if
  22.  
  23. End Sub