vb中label如何输出多个数
DimtAsInteger,xAsInteger,yAsInteger,zAsInteger,tAsIntegerx=Val(Text1.Text)y=Val(Text2...
Dim t As Integer, x As Integer, y As Integer, z As Integer, t As Integer
x = Val(Text1.Text)
y = Val(Text2.Text)
z = Val(Text3.Text)
If x > y Then
t = y: y = x: x = t
ElseIf y > z Then
t = z: z = y: y = t
Else
t = x: x = z: z = t
Label6.Caption = "x=" & x;"y=" & y; "z=" & z
End If 展开
x = Val(Text1.Text)
y = Val(Text2.Text)
z = Val(Text3.Text)
If x > y Then
t = y: y = x: x = t
ElseIf y > z Then
t = z: z = y: y = t
Else
t = x: x = z: z = t
Label6.Caption = "x=" & x;"y=" & y; "z=" & z
End If 展开
2个回答
展开全部
见下面程序,在一个Label上,输出多个数
Option Explicit
'在Label1上显示多个数,每行显示1个数
Private Sub PrintOnLabel(ByVal x)
Dim s As String
'转换成字符串
s = Trim(CStr(x))
'如果字符串为空,则不显示并退出Sub
If s = "" Then Exit Sub
'在Label1上显示数字!注意:这里使用了拼接字符串以及换行符vbCrLf
Label1.Caption = Label1.Caption & CStr(x) & vbCrLf
End Sub
Private Sub Command1_Click()
Dim s As String
'获取输入
s = Text1.Text
'在Label1上显示
PrintOnLabel s
'清空Text1内容,以便再次输入
Text1.Text = ""
End Sub
Private Sub Form_Load()
'清空Label1的内容
Label1.Caption = ""
'清空Text1的内容
Text1.Text = ""
End Sub
运行结果
2013-05-10
展开全部
Label6.Caption = "x=" & x;"y=" & y; "z=" & z修改成Label6.Caption = "x=" & x & " y=" & y & " z=" & z
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询