Welcome to my blog, hope you enjoy reading
RSS

home

Selasa, 09 April 2013

program array


Public Class Form1
    Dim namaSiswa(4) As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        For i = 0 To 4
            ComboBox1.Items.Add(i)
        Next
        ComboBox1.TabIndex = 0
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim no As Integer, i As Integer
        no = CInt(ComboBox1.Text)
        namaSiswa(no) = InputBox("Tuliskan Nama siswa no : " & no, "Input Nama Siswa")
        If namaSiswa(no) <> "" Then
            ListBox1.Items.Clear()
            For i = 0 To 4
                ListBox1.Items.Add("namaSiswa (" & i & ")=" & namaSiswa(i))
            Next
        End If
    End Sub


HASIL:






Program Kontrol Perulangan pada VB NET


Public Class Form1
    Dim a As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Clear()
        For a = 1 To 100
            ListBox1.Items.Add(a)
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
        For a = 100 To 1 Step -2
            ListBox1.Items.Add(a)
        Next
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListBox1.Items.Clear()
        a = Asc("A")
        Do Until a > Asc("Z")
            ListBox1.Items.Add("huruf :" & Chr(a))
            a = a + 1
        Loop
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        ListBox1.Items.Clear()
        a = Asc("Z")
        Do While a >= Asc("A")
            ListBox1.Items.Add("huruf :" & Chr(a))
            a = a - 1
        Loop
    End Sub
End Class


HASIL:






Minggu, 07 April 2013

program Select Case pada VB net


1.Buat project baru, desain sesuai yang anda inginkan
2. disini saya menggunakan listbox1,textbox,label
3. klik 2x pada form dan masukkan listing program dibawah ini:



Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        ListBox1.Items.Add("Disket")
        ListBox1.Items.Add("Buku")
        ListBox1.Items.Add("Kertas")
        ListBox1.Items.Add("Pulpen")
    End Sub

4. klik 2x pada button1 dan masukkan listing program dibawah ini:

    Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        Dim harga As Integer, total As Integer
        Dim jumlah As Integer
        Dim diskon As Single
        Dim satuan As String

        If ListBox1.Text = "" Then
            MsgBox("Anda Belum Memilih barang")
            ListBox1.Items.Add(0)

        End If

        If TextBox1.Text = "" Then
            MsgBox("Anda Tidak memasukkan jumlah barang")
            TextBox1.Focus()

        End If

        Select Case ListBox1.Text
            Case "Disket"
                harga = 3500
                satuan = "Box"

            Case "Buku"
                harga = 20000
                satuan = "Lusin"
            Case "Kertas"
                harga = 25000
                satuan = "Rim"
            Case "Pulpen"
                harga = 10000
                satuan = "Pak"

        End Select

        Label3.Text = "Barang : " & ListBox1.Text
        Label4.Text = "Harga : " & Format(harga, "Currency") & "/" & satuan
        Label5.Text = "Jumlah : " & TextBox1.Text & "" & satuan
        jumlah = TextBox1.Text

        Select Case jumlah
            Case Is < 10
                diskon = 0
            Case 10 To 20
                diskon = 0.15
            Case Else
                diskon = 0.2

        End Select
        total = jumlah * (harga * (1 - diskon))
        Label6.Text = "Diskon : " & Format(diskon, "0%")
        Label7.Text = "Total Bayar : " & Format(total, "Currency")



    End Sub
End Class

Hasil:







Program Struktur Kontrol IF

1. Buat project baru, desain sesuai yang anda inginkan
2. disini saya menggunakan button1 dan picture1
3. masukkan listing program dibawah ini:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "Nusantara" Then
            PictureBox1.Visible = True


        Else
            PictureBox1.Visible = False
        End If
    End Sub
End Class


HASIL





Jika password nya salah maka tidak akan keluar gambar












program EVENT dan METHOD pada VB net


1. Buat project baru,desain sesuai yang anda inginkan
2. disini saya menggunakan toolbox combobox1,button1,button2,dan listbox1,
3. input listing program dengan menekan 2x pada form tersebut , seperti dibawah ini:


Public Class Form4
    Dim item As String
    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("Umar")
        ComboBox1.Items.Add("Salman")
        ComboBox1.Items.Add("Halimah")
        ComboBox1.Items.Add("Shafira")

    End Sub

4. lalu  input listing program dengan menekan 2x pada button1 tersebut , seperti dibawah ini:
    
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
         ListBox1.Items.Add(ComboBox1.Text)
    End Sub

5.  input listing program dengan menekan 2x pada button2 tersebut , seperti dibawah ini:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Remove(ListBox1.Text)

    End Sub
 6.  input listing program dengan menekan 2x pada button3 tersebut , seperti dibawah ini:
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListBox1.Items.Clear()
    End Sub



HASIL:


DATA dan VARIABEL pada VB net

1. buat project baru, dan desain sesuai yang anda inginkan
2. Disini saya menggunakan button1,button2,button3,button4,label1,label2,dan label3
3. Masukkan listing program pada button1, seperti dibawah ini:


Public Class Form6

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim test1 As String
        test1 = "nusantara"
        Label1.Text = test1.ToString

    End Sub

 4. Masukkan listing program pada button2, seperti dibawah ini:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim test2 As String
        test2 = "indonesia"
        Label2.Text = test2.ToString
    End Sub

5. Masukkan listing program pada button3, seperti dibawah ini: 
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim test3 As String
        test3 = "tanah airku"
        Label3.Text = test3.ToString
    End Sub

6. Masukkan listing program pada button4, seperti dibawah ini:
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        End
    End Sub
End Class

HASIL:








membuat login menggunakan vb net

1. Buat project dan desain sesuai yg kita inginkan
2. disini saya menggunakan toolbox button1 dan button2
3. masukkan listing program di button1 dan button2:


Public Class Form8

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Me.TextBox1.Text = "suci" And Me.TextBox2.Text = "suci" Then
            Me.Hide()
            MsgBox("kata Sandi benar")
            Form2.Show()

        Else

            MsgBox("kata Sandi Salah")

        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class


HASIL