Jam Digital menggunakan Visual Basic 2008 menggunakan Microsoft Visual Basic 2008 Express Edition.
Toolbox yang digunakan:
Perancangan/ Design tampilan, perhatikan gambar di bawah ini:
Source atau sintaks program sesuai dengan nama pada ToolBox yang saya berikan diatas:
Public Class Form1
Private Declare Sub GetSystemTime Lib"kernel32"ByRef lpSystemTime As SYSTEMTIME)
Private Structure SYSTEMTIME
Public wYear As Short
Public wMonth As Short
Public wDayOfWeek As Short
Public wDay As Short
Public wHour As Short
Public wMinute As Short
Public wSecond As Short
Public wMilliseconds As Short
End Structure
#Region" World Clock Variables "
Dim lpT As SYSTEMTIME
Dim dateUTC As Date
Dim WTime As Date
#End Region
Private Sub getWorldClock()
Try
Call GetSystemTime(lpT)
’India
dateUTC = Date.Today.AddHours(5.5)
WTime = CDate(lpT.wHour & " : " & lpT.wMinute & " :" & lpT.wSecond).AddHours(5.5)
txtTimeIndia.Text = WTime.ToLongTimeString
lblDayIndia.Text = dateUTC.DayOfWeek().ToString()
’Austria/Germany
dateUTC = Date.Today().AddHours(1.0)
WTime = CDate(lpT.wHour & " : " & lpT.wMinute & " :" & lpT.wSecond).AddHours(1.0)
txtTimeAustria.Text = WTime.ToLongTimeString
lblDayAustria.Text = dateUTC.DayOfWeek().ToString()
’Zhuhai
dateUTC = Date.Today.AddHours(8.0)
WTime = CDate(lpT.wHour & " : " & lpT.wMinute & " :" & lpT.wSecond).AddHours(8.0)
txtTimeZhuhai.Text = WTime.ToLongTimeString
lblDayZhuhai.Text = dateUTC.DayOfWeek().ToString()
’Indonesia
dateUTC = Date.Today.AddHours(7.0)
WTime = CDate(lpT.wHour & " : " & lpT.wMinute & " :" & lpT.wSecond).AddHours(7.0)
txtTimeBatam.Text = WTime.ToLongTimeString
lblDayBatam.Text = dateUTC.DayOfWeek().ToString()
’Singapore/JB
dateUTC = Date.Today.AddHours(8.0)
WTime = CDate(lpT.wHour & " : " & lpT.wMinute & " :" & lpT.wSecond).AddHours(8.0)
txtTimeSingapore.Text = WTime.ToLongTimeString
lblDaySingopure.Text = dateUTC.DayOfWeek().ToString()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
lblJalan.Text = "Ini adalah program untuk melihat jam pada beberapa negara di dunia....."
End Sub
Private Sub tmrWorldClock_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrWorldClock.Tick
getWorldClock()
End Sub
Private Sub tmrText_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrText.Tick
Dim s1 AsString
Dim S2 AsString
s1 = Microsoft.VisualBasic.Left(lblJalan.Text, 1)
S2 = Microsoft.VisualBasic.Right(lblJalan.Text, Len(lblJalan.Text) - 1)
lblJalan.Text = S2 + s1
End Sub
End Class
Selamat mencoba Guys! Nantikan Tips Aplikasi Cantik Lainnya by Verynandus Hutabalian
0 komentar:
Posting Komentar