大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Dim SumN As Long
创新互联专业提供成都主机托管四川主机托管成都服务器托管四川服务器托管,支持按月付款!我们的承诺:贵族品质、平民价格,机房位于中国电信/网通/移动机房,香港机房服务器托管服务有保障!
Dim i As Integer
Dim str As String
str = InputBox("请输入个数:")
i = Val(str)
If i 1 Then
Exit Sub
End If
Dim k As Integer
Try
For k = 1 To i
SumN = SumN + k ^ k
Next
MsgBox("结果:" SumN)
Catch
End Try
'1、直接在窗体上写:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As Graphics = Graphics.FromHwnd(Handle), f As New Font("宋体", 9), tmp = "", a(5)
Me.Refresh()
For i As Int16 = 0 To 5
a(i) = Val(InputBox("请输入第" i + 1 "个数", "输入六个数据进行排序"))
tmp = Str(a(i))
Next
g.DrawString("你输入的数据是:" tmp, f, Brushes.Black, 10, 10)
For i As Int16 = 0 To 4
For j As Int16 = i + 1 To 5
If a(i) a(j) Then tmp = a(i) : a(i) = a(j) : a(j) = tmp
Next
Next
g.DrawString("排序的结果是:" Join(a, " "), f, Brushes.Black, 10, 40)
tmp = ""
End Sub
End Class
'2、使用label显示,这个应该完全可以符合要求。
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "你输入的数据是:" : Label2.Text = "排序的结果是:" : Button1.Text = "开始"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tmp = "", a(5)
For i As Int16 = 0 To 5
a(i) = Val(InputBox("请输入第" i + 1 "个数", "输入六个数据进行排序"))
tmp = Str(a(i))
Next
Label1.Text = "你输入的数据是:" tmp
For i As Int16 = 0 To 4
For j As Int16 = i + 1 To 5
If a(i) a(j) Then tmp = a(i) : a(i) = a(j) : a(j) = tmp
Next
Next
Label2.Text = "排序的结果是:" Join(a, " ")
tmp = ""
End Sub
End Class
VB(Visual Basic)是由微软公司开发的包含环境的事件驱动编程语言。它源自于BASIC编程语言。VB拥有图形用户界面(GUI)和快速应用开发程序(RAD)系统,可以轻易的使用DAO、RDO、ADO连接数据库,或者轻松的创建ActiveX控件。程序员可以轻松地使用VB提供的组件快速创建一个应用程序。
Visual Basic .NET(VB.NET)是.NET Framework框架下的一种多重编程范式高级语言。
VB.NET,是微软公司于2002年作为原有的Visual Basic的继承者而推出。虽然自2005年起,语言名称中的“.NET”就已经被去掉了。但为了与VB 6.0及以前版本的Visual Basic进行区分,
“Visual Basic .NET”的名字仍然被社会公众用来指代VB 7.0及以后的Visual Basic。VB.NET与C#同为.Net Framework框架下两种主要的程序设计语言,都是为了调用.Net Framework的类库资源,因此两种语言具有很高的对应性,数据类型、控制结构与语言特性都存在一一对应,容易把源代码从一种语言对译为另一种语言。