龙空技术网

用Visual Studio 2013编写计算三角形面积VB小程序

北京晨歌 362

前言:

当前姐妹们对“vbnet三角形”都比较着重,看官们都想要学习一些“vbnet三角形”的相关内容。那么小编也在网络上收集了一些关于“vbnet三角形””的相关知识,希望各位老铁们能喜欢,看官们快快来学习一下吧!

VB虽说不再是当今编程语言的主流,但VB所拥有图形用户界面GUI)和快速应用程序开发(RAD)系统,可以让我们轻松的使用VB提供的组件快速建立一个应用程序。下面我们一起来做一个小程序,回味经典。

界面设计:

程序运行效果图

各项参数设置

代码设计:

Public Class Form1

Dim a As Single, p As Single

Dim b As Single, s As Single

Dim c As Single

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

a = Val(TextBox1.Text)

b = Val(TextBox2.Text)

c = Val(TextBox3.Text)

p = (a + b + c) / 2

s = Math.Sqrt(p * (p - a) * (p - b) * (p - c))

TextBox4.Text = Str(s)

End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged

End Sub

Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

TextBox4.Text = ""

End Sub

Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

End

End Sub

End Class

运行结果:

运行结果图

最后多说一句,没有过时的程序语言,只要能满足工作需要就是好的语言。

标签: #vbnet三角形 #vb画三角形代码 #vb打印三角形代码 #vb编程打印三角形 #vb编程输出三角形图案