Listing Program:
text1 = "+"
End Sub
Private Sub cmd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd1.Click
tex.Text += "1"End Sub
Private Sub cmdHasil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdHasil.Click
Dim w As DoubleIf text1 = "+" Then
'w = newLibrary.fcTambah(Convert.ToDouble(TextBox1.Text), Convert.ToDouble(TextBox2.Text))
w = newClass.fcTambah(TextBox1.Text, TextBox2.Text)
txtHasil.Text = w.ToString
ElseIf text1 = "-" Then
w = newClass.fcKurang(TextBox1.Text, TextBox2.Text)
txtHasil.Text = w.ToString
ElseIf text1 = "*" Then
w = newClass.fcKali(TextBox1.Text, TextBox2.Text)
txtHasil.Text = w.ToString
Else
w = newClass.fcBagi(TextBox1.Text, TextBox2.Text)
txtHasil.Text = w.ToString
End If
End Sub
Class.vb
Function fcTambah(ByVal angka1 As Double, ByVal angka2 As Double) As Double
Dim result As Doubleresult = angka1 + angka2
Return result
End Function
No comments:
Post a Comment