In this activity the GetTime application as implemented in the native code and XAML chapters, is implemented as a Managed Code VB .NET CF application.
At the bottom of the Visual Designer windows, locate the Menu control icon and delete it. As we have no menu, this just takes up space at the top of the form and may impinge upon what the TextBox displays.
Public Class frmManagedTime Private Sub TimeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeButton.Click End Sub Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click End Sub End Class
Public Class frmManagedTime
Private Sub TimeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeButton.Click
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
End Class
TextBox1.Text = DateTime.Now.ToString()
Application.Exit()
Now to run the application on the target device using CoreCon.
Refer the 16.4 CoreCon Application Development Connectivity.
Dim localTime as DateTime = DateTime.Now _ Dim dateTimeStr as string = string.Format( _ "Time {0}:{1}:{2} Date {3}//{4}//{5}", _ localTime.Hour, localTime.Minute, localTime.Second, _ localTime.Day, localTime.Month, localTime.Year) TextBox1.Text = dateTimeStr
Dim localTime as DateTime = DateTime.Now _
Dim dateTimeStr as string = string.Format( _
"Time {0}:{1}:{2} Date {3}//{4}//{5}", _
localTime.Hour, localTime.Minute, localTime.Second, _
localTime.Day, localTime.Month, localTime.Year)
TextBox1.Text = dateTimeStr
More: 17.4 Calling Native Code from Managed Code
Click here to provide feedback and input