Boolean property returns false at runtime despite being set to "true" via Designer

Viewed 570

Hopefully this has a simple fix:

I have created a custom textbox for my solution. To that custom control I added an auto property called "AllowEmpty":

Public Property AllowEmpty As Boolean

Both my constructor and event read that property's value and act accordingly:

Public Sub New()

    If AllowEmpty Then
        Text = String.Empty
    Else
        Text = "0"
    End If

End Sub

Private Sub CustomTextBox_TextChanged(sender As Object, e As EventArgs) Handles Me.TextChanged

    If AllowEmpty Then
        Text = String.Empty
    Else
        Text = "0"
    End If

End Sub

However by setting a breakpoint I see that if I set "AllowEmpty" to True on the Designer, it's still false at runtime. Am I missing something?

Thanks.

1 Answers
Related