S
shapper
Hello,
Let me explain it better. What I need is to make something like:
Dim mc as MyControl
mc.Value = "Hello"
This would create a MyControl instance and would set the TextBox.Text
= "Hello"
Then, I would need retrieve its value through the property on, for
example, a MyControl event:
Sub mc_CustomEvent(...) Handles mc.CustomEvent
Dim s as string
s = mc.Value
End Sub
Inside my custom control I have the property defined as follows:
Private _Value As String
Public Property Value() As String
Get
Return tbInput.Text
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value
And the TextBox is defined as follows:
Private Sub tbInput_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles tbInput.Init
tbInput.Text = Me.Value
End Sub
Both set and get are not working.
If I use the property as follows:
Private _Value As String
Public Property Value() As String
Get
Return _Value
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value
I am at least able to define the TextBox value.
What am I doing wrong?
Thanks,
Miguel
Let me explain it better. What I need is to make something like:
Dim mc as MyControl
mc.Value = "Hello"
This would create a MyControl instance and would set the TextBox.Text
= "Hello"
Then, I would need retrieve its value through the property on, for
example, a MyControl event:
Sub mc_CustomEvent(...) Handles mc.CustomEvent
Dim s as string
s = mc.Value
End Sub
Inside my custom control I have the property defined as follows:
Private _Value As String
Public Property Value() As String
Get
Return tbInput.Text
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value
And the TextBox is defined as follows:
Private Sub tbInput_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles tbInput.Init
tbInput.Text = Me.Value
End Sub
Both set and get are not working.
If I use the property as follows:
Private _Value As String
Public Property Value() As String
Get
Return _Value
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property ' Value
I am at least able to define the TextBox value.
What am I doing wrong?
Thanks,
Miguel