Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Canceling a Change Event

Status
Not open for further replies.

MattNMNB

Technical User
Sep 25, 2001
7
US
Is it possible to cancel a change event initiated by code. I am using a vertical scroll bar for data input. The scroll bar change event fires when the up arrow or down arrow buttons are picked so I have some code to handle that event. The scroll event executes the same code.

Elsewhere in the program I am manipulating the min, max, and value properties of the scroll bar based on the value in a text box. When this manipulation occurs, it fires the change event (I assume because the .value property changed.)

I want to keep the change event from occuring when the value of the scroll bar is changed in the code but it must still operate when the buttons are pressed. Is there a way to do this?

Thanks,

MattB
 
First thing that pops into my head........
Create a public flag:
Public booDontDoIt As Boolean

In your code, set flag to true when you don't want the Change code to fire. Then in the Change code:

If booDontDoIt Then
booDontDoIt = False
Else
'Change code here
End If Tim

Remember the KISS principle:
Keep It Simple, Stupid!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top