If you want to have a property for your control, that you want to map directly to another controls property (ie if you have a text box in your control, and when the user changes your controls Text property, you want it to automattically change the Textbox's text property), then you can do the following:
'// the back color property. This is called when the client requests
the value of BackColor
Public Property Get Text() As String
BackColor = txtMain.Text '// return the textbox.text
property
End Property
'// this is called when the client requests to change the value of BackColor.
Public Property Let Text(ByVal Text As String)
'// if the property is read only (ie the client cannot change
its value), you do not need this procedure.
'// before you assign the new value, you could check to see
if it is empty etc:
'// If New_Text = Empty Then Exit Property
txtMain.Text = New_Text '// set the textbox.text property
to the new value
PropertyChanged "Text" '// property has changed
End Property
Comments