Jumat, 30 November 2012

tutorial FUNGSI KUADRAT modul 2



PublicClassForm1

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim X, Y, C, D, X1, X2 AsSingle

(Dim ituberartimenyatakandan integer ituberartibilangannumeric)

        X = TextBox1.Text
        Y = TextBox2.Text
        C = TextBox3.Text
        D = Y ^ 2 - (4 * X * C)

If D > 0 Then
            X1 = (-Y + Math.Sqrt(D)) / 2 * X
            X2 = (-Y - Math.Sqrt(D)) / 2 * X

            Label7.Text = X1
            Label8.Text = X2
ElseIf D = 0 Then
            X1 = -Y / (2 * X)
            X2 = -Y / (2 * X)

            Label7.Text = X1
            Label8.Text = X2
Else

(perintah untuk menjawab hasil otomatis dari persamaan kuadrat yang kita isi)

    MsgBox("Akar kuadrat persamaan tersebut adalah IMAGINER !!")
EndIf
EndSub

(MEMBERI PESAN)

PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()
EndSub

(menghentikan program aplikasi)

PrivateSub TextBox1_keypress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim masukan AsBoolean = Char.IsDigit(e.KeyChar)
IfNot masukan Then e.Handled = True
EndSub

(untuk mengatur supaya textbox dapat diisi hanya dengan angka)

PrivateSub TextBox2_keypress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
Dim masukan AsBoolean = Char.IsDigit(e.KeyChar)
IfNot masukan Then e.Handled = True
EndSub

(untuk mengatur supaya textbox dapat diisi hanya dengan angka)

PrivateSub TextBox3_keypress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
Dim masukan AsBoolean = Char.IsDigit(e.KeyChar)
IfNot masukan Then e.Handled = True
EndSub

(untuk mengatur supaya textbox dapat diisi hanya dengan angka)

PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        Label7.Text = ""
        Label8.Text = ""
EndSub

(menghapus text yang sudah diisi untuk diisikan dengan isi yang lain)

PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
        BackColor = Color.AntiqueWhite

(memberi warna pada background form)

EndSub
EndClass




TUTORIAL PROGRAM  FUNGSI KUADRAT


KOMPONEN TOOLBOX
1.
Form1
Name
Text
Form1
Fungsi Akar Kuadrat
2.
Label1
Name
Text
Label1
Menghitung Akar Fungsi Kuadrat
3.
Label4
Name
Text
Label4
X
4.
Label5
Name
Text
Label5
Y
5.
Label6
Name
Text
Label6
Z
6.
TextBox1
Name
Text
TextBox1
7.
TextBox2
Name
Text
TextBox2
8.
TextBox3
Name
Text
TextBox3
9.
Label2
Name
Text
Label2
X²
10.
Label3
Name
Text
Label3
X
11.
Botton1
Name
Text
Botton1
OKE
12.
Label7
Name
Text
Label7
X1 =
13.
Label8
Name
Text
Label8
X2 =
14.
Botton2
Name
Text
Botton2
EXIT
15
Botton3
Name
Text
Botton3
CLEAR



Tidak ada komentar:

Posting Komentar