Sabtu, 05 Juni 2010

Belajar VB Net

Praktek yang pertama saya mencoba bikin aplikasi standar dulu ah. Maklum masih pemula dalam hal programming. Kali ini saya akan belajar bahasa Pemrograman VB. Net. Pertama bikin form seperti dibawah in:


Beberapa komponen yang dibutuhkan diantaranya adalah:
- Textbox1
- Timer1
- StatusStrip1 (- ToolStripStatusLabel1, ToolStripStatusLabel2)

Listing Programnya adalah sebagai berikut :

Public Class Form1
Dim waktu As Date
Dim tanggal As String
Dim pass As String
Dim PASS1 As String
Dim password As String

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
waktu = Format(Now(), "HH:mm:ss")
tanggal = Format(Now(), "ddd, dd-MM-yyyy")
ToolStripStatusLabel1.Text = tanggal
ToolStripStatusLabel2.Text = waktu
pass = Format(Now(), "mm")
PASS1 = Format(Now(), "ddMM")
password = PASS1 + pass
TextBox1.Focus()
End Sub

Private Sub TextBox1_KeyPress_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
Me.TextBox1.Focus()
If TextBox1.Text = password Then
MsgBox("Password Yang Anda Masukkan Benar")
TextBox1.Clear()
TextBox1.Focus()
Else
MsgBox("Password Yang Anda Masukkan Salah")
TextBox1.Clear()
TextBox1.Focus()
End If
End If
End Sub
End Class

Twitter Delicious Facebook Digg Stumbleupon Favorites More