Sabtu, 26 Februari 2011

Form Sederahana Visual Studio

Untuk membuat form seperti di bawah ini :
1. Source Code Label Masukkan, Hasil, Proses dan Proses2 silahkan copy coding :
Public Class Form1
    Dim jurusan As String
    Dim kelas, jenjang As String, waktu As Integer
    Dim d As Integer = 5

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Call perintah()
    End Sub

    Sub perintah()
        Dim lo As String
        If TextBox1.Text = "TI" Then
            lo = "06"
            TextBox2.Text = "Tekhnik Informatika"
        Else
            If TextBox1.Text = "SI" Then
                TextBox2.Text = "Sistem Informasi"
            End If
        End If
    End Sub

2. Source Code Data1, Data2, Data3, Data4, Data5 dan ListBox, silahkan copy coding di bawah :

 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Call perintah()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListBox1.Items.Add(TextBox3.Text + " " & TextBox4.Text & " " & TextBox5.Text & " " & TextBox6.Text & " " & TextBox7.Text)
    End Sub

    Sub pros3()
        ListBox1.Items.Add(TextBox3.Text + "" & TextBox4.Text & "" & TextBox5.Text & "" & TextBox6.Text & "" & TextBox7.Text)
    End Sub

    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox4.Focus()
        End If
    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged

    End Sub

    Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox5.Focus()
        End If
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged

    End Sub

    Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox6.Focus()
        End If
    End Sub

    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged

    End Sub

    Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox7.Focus()
        End If
    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class


> Private Sub di peroleh dengan cara double klick pada design / form yang akan di buat.

> Variabel ada 3 :
  • Variabel public = variabel yang bisa digunakan untuk semua form , ckass dalam sato project.
  • Variabel general = variabel yang bisa digunakan hanya dalam satu class . contoh Dim Jur.
  • Variabel local    = variabel yang bisa digunakan hanya di dalam lingkungan sendiri . contoh : Dim i As String.  

0 komentar:

Posting Komentar

, kalaw mau komentar yang ikhlas y !

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Free Web Hosting