Click here to Skip to main content
15,891,033 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How Can I Join VB Applications? Pin
Christian Graus25-Nov-07 19:37
protectorChristian Graus25-Nov-07 19:37 
AnswerRe: How Can I Join VB Applications? Pin
Paul Conrad26-Nov-07 16:12
professionalPaul Conrad26-Nov-07 16:12 
Questionreflection issue Pin
Tauseef A25-Nov-07 18:39
Tauseef A25-Nov-07 18:39 
AnswerRe: reflection issue Pin
Dave Kreskowiak26-Nov-07 2:44
mveDave Kreskowiak26-Nov-07 2:44 
GeneralRe: reflection issue Pin
nlarson1126-Nov-07 16:15
nlarson1126-Nov-07 16:15 
GeneralRe: reflection issue Pin
Dave Kreskowiak27-Nov-07 4:49
mveDave Kreskowiak27-Nov-07 4:49 
GeneralRe: reflection issue Pin
nlarson1127-Nov-07 5:00
nlarson1127-Nov-07 5:00 
GeneralRe: reflection issue Pin
Dave Kreskowiak27-Nov-07 5:24
mveDave Kreskowiak27-Nov-07 5:24 
nlarson11 wrote:
each control has an event "enabledchanged" is there a way to make this fire even if you give it the same value? Enabled=true / Enabled=true?


No, it'll fire whenever the value actually changes.


nlarson11 wrote:
Is there any other technique that can be done that doesn't envolve creating my own control wrapper to detect this?


Nope. You have to replace the Enabled property's Set method of the controls to get this to work. As it stands now, the Enable property code is this:
<DispId(-514), Localizable(True), SRCategory("CatBehavior"), SRDescription("ControlEnabledDescr")> _
Public Property Enabled As Boolean
    Get
        If Not Me.GetState(4) Then
            Return False
        End If
        Return ((Me.ParentInternal Is Nothing) OrElse Me.ParentInternal.Enabled)
    End Get
    Set(ByVal value As Boolean)
        Dim enabled As Boolean = Me.Enabled
        Me.SetState(4, value)
        If (enabled <> value) Then
            If Not value Then
                Me.SelectNextIfFocused
            End If
            Me.OnEnabledChanged(EventArgs.Empty)
        End If
    End Set
End Property

See the bolded If statement?? That's why the event won't fire if the value doesn't actually change. If the internal enabled variable is the same as the value passed in, the OnEnabledChanged method is never called, which is what raises the event.

Actually, the more I think about this, I'd ADD A NEW EVENT, possibly called EnabledSet, and raise it from the Set code in the Enabled property. I would NOT change the behavior of the existing EnabledChanged event.



A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: reflection issue Pin
nlarson1127-Nov-07 5:37
nlarson1127-Nov-07 5:37 
QuestionHow to find Reciprocal URL Pin
swguy2325-Nov-07 17:29
swguy2325-Nov-07 17:29 
AnswerCross Posted from Web Develoment Forum (x3) -- Ignore Pin
Vasudevan Deepak Kumar25-Nov-07 17:54
Vasudevan Deepak Kumar25-Nov-07 17:54 
GeneralRe: Cross Posted from Web Develoment Forum (x3) -- Ignore Pin
Paul Conrad25-Nov-07 18:17
professionalPaul Conrad25-Nov-07 18:17 
AnswerRe: How to find Reciprocal URL Pin
Paul Conrad25-Nov-07 18:16
professionalPaul Conrad25-Nov-07 18:16 
QuestionCreate a Fill() function with parametres Pin
dcode2525-Nov-07 13:59
dcode2525-Nov-07 13:59 
AnswerRe: Create a Fill() function with parametres Pin
Dave Kreskowiak26-Nov-07 2:38
mveDave Kreskowiak26-Nov-07 2:38 
QuestionInstall ui Pin
UsuallyConfused25-Nov-07 11:30
UsuallyConfused25-Nov-07 11:30 
AnswerRe: Install ui Pin
Christian Graus25-Nov-07 14:02
protectorChristian Graus25-Nov-07 14:02 
GeneralRe: Install ui Pin
UsuallyConfused25-Nov-07 21:33
UsuallyConfused25-Nov-07 21:33 
Questioneasy ADO error when opening catalog 'reference not set' Pin
Reveille25-Nov-07 9:04
Reveille25-Nov-07 9:04 
AnswerRe: easy ADO error when opening catalog 'reference not set' Pin
Mycroft Holmes25-Nov-07 15:34
professionalMycroft Holmes25-Nov-07 15:34 
QuestionoVideo encryption Pin
Jamal Abdul Nasir25-Nov-07 8:18
Jamal Abdul Nasir25-Nov-07 8:18 
AnswerRe: oVideo encryption Pin
Christian Graus25-Nov-07 8:31
protectorChristian Graus25-Nov-07 8:31 
Questionadd column type in datagrid Pin
liat123425-Nov-07 6:12
liat123425-Nov-07 6:12 
AnswerRe: add column type in datagrid Pin
Christian Graus25-Nov-07 8:32
protectorChristian Graus25-Nov-07 8:32 
Questionupdata database from datagrid Pin
liat123425-Nov-07 6:09
liat123425-Nov-07 6:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.