ganjafarmerIT
Programmer
Hi guys, I'm trying to create a costum windows form control that consists of 4 controls:
a checkbox, and three labels.
I can't seem to get it to work. The problem I'm dealing with is that I can't assign any values to the labels when running my app. the label text doesn't change.
Here is my control's code:
<code>
Inherits Control
Private myCheckbox As New CheckBox
Private WithEvents myTime As New Label
Private WithEvents myStatus As New Label
Private WithEvents mySendsize As New Label
Public Sub New()
myTime.Name = "myTime1"
Me.Controls.Add(myCheckbox)
Me.Controls.Add(myTime)
Me.Controls.Add(myStatus)
Me.Controls.Add(mySendsize)
End Sub
#Region "set functions"
Public Sub setTime(ByVal time As String)
myTime.Text = time
End Sub
Public Sub setStatus(ByVal status As String)
myStatus.Text = status
End Sub
Public Sub setsendsize(ByVal size As String)
mySendsize.Text = size
End Sub
#End Region
</code>
Now I tried using properties instead of subs, but even thos won't work.
If I call the sub setsendsize("test")
nothing happens.
Hope you guys can help me on this one cause it's giving me a headache, it's not supposed to be this hard. I've created controls in asp.net and that was easy.
a checkbox, and three labels.
I can't seem to get it to work. The problem I'm dealing with is that I can't assign any values to the labels when running my app. the label text doesn't change.
Here is my control's code:
<code>
Inherits Control
Private myCheckbox As New CheckBox
Private WithEvents myTime As New Label
Private WithEvents myStatus As New Label
Private WithEvents mySendsize As New Label
Public Sub New()
myTime.Name = "myTime1"
Me.Controls.Add(myCheckbox)
Me.Controls.Add(myTime)
Me.Controls.Add(myStatus)
Me.Controls.Add(mySendsize)
End Sub
#Region "set functions"
Public Sub setTime(ByVal time As String)
myTime.Text = time
End Sub
Public Sub setStatus(ByVal status As String)
myStatus.Text = status
End Sub
Public Sub setsendsize(ByVal size As String)
mySendsize.Text = size
End Sub
#End Region
</code>
Now I tried using properties instead of subs, but even thos won't work.
If I call the sub setsendsize("test")
nothing happens.
Hope you guys can help me on this one cause it's giving me a headache, it's not supposed to be this hard. I've created controls in asp.net and that was easy.