|
-
Jan 2nd, 2007, 06:54 PM
#1
Thread Starter
Frenzied Member
Custom Control = Value to be executed twice..?
Hello,
Getting a bit of a headache here because having debugged my soft for hours, i realise i get the Value property get executed twice.
VB Code:
Public Property Get Value() As CheckBoxConstants
Value = m_Value
End Property
Public Property Let Value(ByVal NewValue As CheckBoxConstants)
If Enabled = True Then
m_Value = NewValue
Check1.Value = m_Value 'Problem is here ¦ Exec No:1
RaiseEvent Click 'And here Exec No: 2
PropertyChanged "Value"
End If
End Property
Basically in order to get the checkbox showing ticked, i do check1.value = m_value and then RaiseEvent and that should be it in theory.
But this then has RiaseEvent Click followed after it, which triggers the Value property again, resulting in 2 executions.
I need to figure out a way to do a single execution only.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Jan 2nd, 2007, 07:00 PM
#2
Re: Custom Control = Value to be executed twice..?
Changing Value property of a checkbox raises the checkbox's click event. If you have RaiseEvent Click in checkbox's click event then changing the value of the checkbox raises the click event of the user control.
Edit
Simplified what I said.
-
Jan 2nd, 2007, 07:18 PM
#3
Thread Starter
Frenzied Member
Re: Custom Control = Value to be executed twice..?
Yea thats what its currently doing..
But i need to find a way so it doesn do this.. i need 1 execution only.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Jan 2nd, 2007, 07:23 PM
#4
Re: Custom Control = Value to be executed twice..?
If you change Check1.Value then you just don't need to have the additional RaiseEvent after Check1.Value line, because changing the Check1.Value does raise the event. So you're knowingly doing it twice when you could just drop the RaiseEvent line from there.
-
Jan 2nd, 2007, 07:44 PM
#5
Thread Starter
Frenzied Member
Re: Custom Control = Value to be executed twice..?
ok.. i get what you are saying.
I put the RaiseEvent under the Check1_Click event. Seems to work fine,,BUT
If i click on the control then it executes the Value Property, then the Check1_Click event all fine...
However if i do check1.value = 1 or 0 then the Value property fires up but the Check1_Click property doesnt...
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Jan 2nd, 2007, 07:54 PM
#6
Frenzied Member
Re: Custom Control = Value to be executed twice..?
what is your software about?
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Jan 2nd, 2007, 07:56 PM
#7
Re: Custom Control = Value to be executed twice..?
Setting a value for Check1.value will fire Check1.Click just when the value changes, i.e: if Check1.value = 0 and you execute Check1.value = 0, Check1.Click won't fire.
-
Jan 2nd, 2007, 07:57 PM
#8
Thread Starter
Frenzied Member
Re: Custom Control = Value to be executed twice..?
what is your software about?
Cannot reveal any info on it for now!
---------------------------------------
This is what i have now:
VB Code:
Private Sub Check1_Click()
RaiseEvent Click
End Sub
Public Property Get Value() As CheckBoxConstants
Value = m_Value
End Property
Public Property Let Value(ByVal NewValue As CheckBoxConstants)
If Enabled = True Then
m_Value = NewValue
Check1.Value = m_Value 'Doesnt fire From here if i do check1.value = 1/0
PropertyChanged "Value"
End If
End Property
Last edited by some1uk03; Jan 2nd, 2007 at 08:02 PM.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|