0% found this document useful (0 votes)
18 views

"A" "A" "B" "B" "C" "C": Form2

The document contains code for a Windows form application with 4 forms (Form1, Form2, Form3, Form4). Form1 contains buttons that show different forms based on text input. The other forms contain controls and code to perform calculations when buttons are clicked, like factorial calculation on Form2 and equation solving on Form4. Buttons allow clearing fields and returning to Form1.

Uploaded by

Lia Ade Putri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

"A" "A" "B" "B" "C" "C": Form2

The document contains code for a Windows form application with 4 forms (Form1, Form2, Form3, Form4). Form1 contains buttons that show different forms based on text input. The other forms contain controls and code to perform calculations when buttons are clicked, like factorial calculation on Form2 and equation solving on Form4. Buttons allow clearing fields and returning to Form1.

Uploaded by

Lia Ade Putri
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.

EventArgs) Handles
Button1.Click
Select Case TextBox1.Text
Case "A", "a"
Form2.Show()
Case "B", "b"
Form3.Show()
Case "C", "c"
Form4.Show()
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
TextBox1.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
End
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles PictureBox1.Click
End Sub
End Class
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim a, b, i As Integer
i=1
b = TextBox1.Text
For a = 1 To b
i=i*a
Next
TextBox2.Text = i
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
Form1.Show()
Me.Hide()

End Sub
End Class
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
If RadioButton2.Checked = True Then
TextBox12.Text = Val(TextBox1.Text) + Val(TextBox8.Text)
TextBox11.Text = Val(TextBox2.Text) + Val(TextBox7.Text)
TextBox10.Text = Val(TextBox3.Text) + Val(TextBox6.Text)
TextBox9.Text = Val(TextBox4.Text) + Val(TextBox5.Text)
ElseIf RadioButton3.Checked = True Then
TextBox13.Text = (Val(TextBox1.Text) * Val(TextBox4.Text) - Val(TextBox2.Text) *
Val(TextBox3.Text)) + (Val(TextBox8.Text) * Val(TextBox5.Text) - Val(TextBox7.Text) *
Val(TextBox6.Text))
Else
TextBox12.Text = (Val(TextBox1.Text) * Val(TextBox8.Text)) + (Val(TextBox2.Text) *
Val(TextBox6.Text))
TextBox11.Text = (Val(TextBox1.Text) * Val(TextBox7.Text)) + (Val(TextBox2.Text) *
Val(TextBox5.Text))
TextBox10.Text = (Val(TextBox3.Text) * Val(TextBox8.Text)) + (Val(TextBox4.Text) *
Val(TextBox6.Text))
TextBox9.Text = (Val(TextBox3.Text) * Val(TextBox7.Text)) + (Val(TextBox4.Text) *
Val(TextBox5.Text))
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class

Public Class Form4


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim a, b, c, D, X1, X2 As Double
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = Val(TextBox3.Text)
D=b^2-4*a*c
TextBox4.Text = D
X1 = (-b + D ^ 0.5) / (2 * a)
X2 = (-b - D ^ 0.5) / (2 * a)
If D = 0 Then
TextBox5.Text = X1
TextBox6.Text = "dua akar kembar"
End If
' TextBox5.Text = X1
' TextBox6.Text = X2
End Sub
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
Form1.Show()
Me.Hide()
End Sub
End Class

You might also like