Drstein99 Posted November 7, 2003 Posted November 7, 2003 I want to dim a boolean object in the beginning of the form, as public. Dim eTest as boolean = false Now I want to add an event, changed to be executed when I change the state from "true" to "false" and vice-versa. Like this: private sub eTestChange() handles etest.statechange end sub But I know that's not how I do it. How would I create an event that triggers when that memory variable is changed? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
*Experts* Volte Posted November 7, 2003 *Experts* Posted November 7, 2003 You can't. Best you could do is do something like this:Dim b As Boolean = False Private Sub SetBool(state As Boolean) b = state 'do other stuff here, that you would do in the event if such thing existed End SubThen use SetBool(true) or SetBool(false) to set the boolean, rather than simply b = True or b = False. Quote
Drstein99 Posted November 7, 2003 Author Posted November 7, 2003 What happens when I change the the value of a scrollbar, like: scrollbar.value = 2 The "scrollbar.ValueChanged" event is called? How come that value knows to call a function? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
*Experts* mutant Posted November 8, 2003 *Experts* Posted November 8, 2003 (edited) The Value member of the scrollbar is a property, from which the event could be raised as well as the internal variable that holds the value that is returned from the property. The way you could do what you want is using properties, just like the Value value of the scrollbar. Edited November 8, 2003 by mutant Quote
Drstein99 Posted November 8, 2003 Author Posted November 8, 2003 Thats EXACTLY what I'm looking for. I looked it up in the help file and (surprisingly), it was useful. Thank you very much; I didnt know what this type of functionality was called or even how to look it up - but you nailed it! Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.