In the previous step you set up the application's user interface and added controls to your application. In this step you'll add code to your application to finalize it.
Complete the following steps:
1. Select View | Code to switch to Code view.
2. In Code view, add the following import statement to the top of the page:
Imports C1.Phone
•C#
using C1.Phone;
3. Add the following C1MaskedTextBox_TextChanged event handlers to the project:
Private Sub c1mtb1_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles c1mtb1.TextChanged
Me.lbl2.Content = "Mask: " & Me.c1mtb1.Mask & " Value: " & Me.c1mtb1.Value & " Text: " & Me.c1mtb1.Text
End Sub
Private Sub c1mtb2_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles c1mtb2.TextChanged
Me.lbl3.Content = "Mask: " & Me.c1mtb2.Mask & " Value: " & Me.c1mtb2.Value & " Text: " & Me.c1mtb2.Text
End Sub
Private Sub c1mtb3_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles c1mtb3.TextChanged
Me.lbl4.Content = "Mask: " & Me.c1mtb3.Mask & " Value: " & Me.c1mtb3.Value & " Text: " & Me.c1mtb3.Text
End Sub
Private Sub c1mtb4_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles c1mtb4.TextChanged
Me.lbl5.Content = "Mask: " & Me.c1mtb4.Mask & " Value: " & Me.c1mtb4.Value & " Text: " & Me.c1mtb4.Text
End Sub
•C#
private void c1mtb1_TextChanged(object sender, TextChangedEventArgs e)
{
this.lbl2.Content = "Mask: " + this.c1mtb1.Mask + " Value: " + this.c1mtb1.Value + " Text: " + this.c1mtb1.Text;
}
private void c1mtb2_TextChanged(object sender, TextChangedEventArgs e)
{
this.lbl3.Content = "Mask: " + this.c1mtb2.Mask + " Value: " + this.c1mtb2.Value + " Text: " + this.c1mtb2.Text;
}
private void c1mtb3_TextChanged(object sender, TextChangedEventArgs e)
{
this.lbl4.Content = "Mask: " + this.c1mtb3.Mask + " Value: " + this.c1mtb3.Value + " Text: " + this.c1mtb3.Text;
}
private void c1mtb4_TextChanged(object sender, TextChangedEventArgs e)
{
this.lbl5.Content = "Mask: " + this.c1mtb4.Mask + " Value: " + this.c1mtb4.Value + " Text: " + this.c1mtb4.Text;
}
4. Add code to the page's constructor so that it appears like the following:
Public Sub New()
InitializeComponent()
Me.c1mtb1_TextChanged(Nothing, Nothing)
Me.c1mtb2_TextChanged(Nothing, Nothing)
Me.c1mtb3_TextChanged(Nothing, Nothing)
Me.c1mtb4_TextChanged(Nothing, Nothing)
End Sub
•C#
public Page()
{
InitializeComponent();
this.c1mtb1_TextChanged(null, null);
this.c1mtb2_TextChanged(null, null);
this.c1mtb3_TextChanged(null, null);
this.c1mtb4_TextChanged(null, null);
}
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.