Selasa, 25 Oktober 2011

Program VB NET 2008

1. Gambar  Desain Program Pertama
* Source Coding Program


Public Class Form1
    Dim KODE As Object
    Sub bersih(ByVal f As Form)
        Dim x As Object
        For Each x In f.Controls
            If TypeOf x Is TextBox Then x.text = ""

        Next
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        th()
        ur()
        jenjang()
    End Sub
    Sub th()
        Dim i As Integer
        For i = 2005 To 2011
            ComboBox1.Items.Add(i)

        Next

    End Sub
    Sub ur()
        Dim i As Integer
        For i = 100 To 536
            ComboBox3.Items.Add(i)
        Next
    End Sub

    Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
        ComboBox4.Text = (Microsoft.VisualBasic.Right(ComboBox1.Text, 2) & KODE & Microsoft.VisualBasic.Left(ComboBox3.Text, 3))
        Dim q As Integer
        For q = 100 To 250
            ComboBox4.Items.Add(Microsoft.VisualBasic.Right(ComboBox1.Text, 2) & KODE & q)
        Next

    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        If ComboBox2.Text = "s1" Then
            KODE = 11
        Else
            KODE = "02"
        End If
        ComboBox4.Text = (Microsoft.VisualBasic.Right(ComboBox1.Text, 2) & KODE)
    End Sub
    Sub jenjang()
        ComboBox2.Items.Add("s1")
        ComboBox2.Items.Add("d3")
    End Sub

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

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x As Object
        x = MsgBox("anda yakin mau keluar??", vbQuestion + vbYesNo, "info")
        If x = vbYes Then
            Me.Close()

        End If
    End Sub

    Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
        ComboBox3.Text = Microsoft.VisualBasic.Right(ComboBox4.Text, 3)
    End Sub
End Class


2. Gambar desain Program Ke dua

* Source coding program
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fx, x As Integer
        x = -1
        fx = Val(2 * x ^ 4 - x ^ 2 + 2 * x - x - 1)
        While (fx) > 0.001
            x = x + 0.001
            fx = Val(2 * x ^ 4 - x ^ 2 + 2 * x - x - 1)
        End While
        ListBox1.Items.Add(fx)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x As Object
        x = MsgBox("anda yakin mau keluar??", vbQuestion + vbYesNo, "informasi")
        If x = vbYes Then
            Me.Close()
        End If
    End Sub
End Class

Tidak ada komentar:

Posting Komentar