Introduction
These controls keep themselves up-to-date automatically. Create visually stunning, highly interactive Windows forms. Update Controls simplify UI programming. And the new tab control features inertia.
How it Works
With other controls, you set properties like "Text" to put data into the form. When the data changes, you have to set the property again. But with Update Controls, you implement events like "GetText". The controls automatically update themselves when the data changes.
The following code is all it takes to attach the First Name text box to the data object:
Public Partial Class ContactForm Inherits Form Private _contact As Contact Public Sub New(ByVal contact As Contact) _contact = contact InitializeComponent() End Sub Private Function firstNameTextBox_GetText() As String Return _contact.FirstName End Function Private Sub firstNameTextBox_SetText(ByVal value As String) _contact.FirstName = value End Sub End Class
The data is stored in a simple object. We start by defining fields:
Public Class Contact Private _firstName As String Private _lastName As String Private _email As String Private _phone As String End Class
Then we press Ctrl+D, Ctrl+G and the library generates dynamic properties:
Public Class Contact Private _firstName As String Private _lastName As String Private _email As String Private _phone As StringEnd ClassDynamic properties
Finally, we add our own business logic:
Public ReadOnly Property FullName() As String Get If String.IsNullOrEmpty(FirstName) AndAlso String.IsNullOrEmpty(LastName) Then Return "New Contact" Else Return String.Format("{0}, {1}", LastName, FirstName) End If End Get End Property
Now our data object is ready for any Update Controls that we want to attach to it. Now or in the future.
