cara membuat program luas dan keliling segitiga, persegi dan lingkaran dengan vb.net
Kali ini saya mau berbagi tentang membuat program luas dan keliling segitiga,
persegi dan lingkaran dengan vb.net, langsung aja liat source code dan
desain formnya, monggo....
source code :
Public Class Form1
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
alas.Clear()
tinggi.Clear()
luas.Clear()
keliling.Clear()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
jari2.Clear()
luaslingkaran.Clear()
kelilinglingkaran.Clear()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ComboBox1.Text = "Persegi" Then
luas.Text = Val(alas.Text) * Val(tinggi.Text)
ElseIf ComboBox1.Text = "Segitiga" Then
luas.Text = (Val(alas.Text) * Val(tinggi.Text)) / 2
End If
If ComboBox1.Text = "Persegi" Then
keliling.Text = (Val(alas.Text) + Val(tinggi.Text)) * 2
ElseIf ComboBox1.Text = "Segitiga" Then
Dim c As Double
c = ((Val(alas.Text) ^ 2) + (Val(tinggi.Text) ^ 2)) ^ 0.5
keliling.Text = (Val(alas.Text) + Val(tinggi.Text) + c)
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim p As Double = 3.14
luaslingkaran.Text = p * (Val(jari2.Text) ^ 2)
kelilinglingkaran.Text = 2 * 3.14 * jari2.Text
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Me.Close()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Me.Close()
End Sub
End Class
Desain formnya :
source code :
Public Class Form1
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
alas.Clear()
tinggi.Clear()
luas.Clear()
keliling.Clear()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
jari2.Clear()
luaslingkaran.Clear()
kelilinglingkaran.Clear()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ComboBox1.Text = "Persegi" Then
luas.Text = Val(alas.Text) * Val(tinggi.Text)
ElseIf ComboBox1.Text = "Segitiga" Then
luas.Text = (Val(alas.Text) * Val(tinggi.Text)) / 2
End If
If ComboBox1.Text = "Persegi" Then
keliling.Text = (Val(alas.Text) + Val(tinggi.Text)) * 2
ElseIf ComboBox1.Text = "Segitiga" Then
Dim c As Double
c = ((Val(alas.Text) ^ 2) + (Val(tinggi.Text) ^ 2)) ^ 0.5
keliling.Text = (Val(alas.Text) + Val(tinggi.Text) + c)
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim p As Double = 3.14
luaslingkaran.Text = p * (Val(jari2.Text) ^ 2)
kelilinglingkaran.Text = 2 * 3.14 * jari2.Text
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Me.Close()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Me.Close()
End Sub
End Class
Desain formnya :
Leave a Comment