怎样将变量结果显示到vb标签中
作了一个计算标准体重的程序,以下是程序代码。结果是用print语句输出的,只会出现在屏幕左上角。现在想让结果输出到指定的标签中,可以用lable3.caption="你的...
作了一个计算标准体重的程序,以下是程序代码。结果是用print语句输出的,只会出现在屏幕左上角。现在想让结果输出到指定的标签中,可以用lable3.caption="你的标准体重是:",来输出字符串,但是不同的输入,对应的标准体重值是不一样的,怎么才能将变化的数值也输出到标签中呢?分都送完了,问题还是没解决。哪位高手指点一下,不胜感激。
Dim weight, height, weightb As Integer
height = Val(Text1.Text)
weight = Val(Text2.Text)
weightb = (height - 100) * 0.9
Print "您的标准体重是:"; weightb
If weight > weightb Then
Print "您偏胖了"; weight - weightb; "公斤!"; "该减肥了!"
Else
If weight < weightb * 0.9 Then
Print "您偏瘦了"; weightb - weight; "公斤!"; "注意增加营养!"
Else
Print "您的体重非常标准,请继续保持!"
End If
End If 展开
Dim weight, height, weightb As Integer
height = Val(Text1.Text)
weight = Val(Text2.Text)
weightb = (height - 100) * 0.9
Print "您的标准体重是:"; weightb
If weight > weightb Then
Print "您偏胖了"; weight - weightb; "公斤!"; "该减肥了!"
Else
If weight < weightb * 0.9 Then
Print "您偏瘦了"; weightb - weight; "公斤!"; "注意增加营养!"
Else
Print "您的体重非常标准,请继续保持!"
End If
End If 展开
4个回答
展开全部
Dim weight, height, weightb As Integer
height = Val(Text1.Text)
weight = Val(Text2.Text)
weightb = (height - 100) * 0.9
'Print "您的标准体重是:"; weightb
label3.caption= "您的标准体重是:" & weightb
If weight > weightb Then
'Print "您偏胖了"; weight - weightb; "公斤!"; "该减肥了!"
label3.caption= "您偏胖了" & weight - weightb & "公斤!; 该减肥了!"
Else
If weight < weightb * 0.9 Then
'Print "您偏瘦了"; weightb - weight; "公斤!"; "注意增加营养!"
label3.caption="您偏瘦了" & weightb - weight & "公斤!; 注意增加营养!"
Else
'Print "您的体重非常标准,请继续保持!"
label3.caption="您的体重非常标准,请继续保持!"
End If
End If
'//////把print语句注释掉,改成label3.caption=""/////
height = Val(Text1.Text)
weight = Val(Text2.Text)
weightb = (height - 100) * 0.9
'Print "您的标准体重是:"; weightb
label3.caption= "您的标准体重是:" & weightb
If weight > weightb Then
'Print "您偏胖了"; weight - weightb; "公斤!"; "该减肥了!"
label3.caption= "您偏胖了" & weight - weightb & "公斤!; 该减肥了!"
Else
If weight < weightb * 0.9 Then
'Print "您偏瘦了"; weightb - weight; "公斤!"; "注意增加营养!"
label3.caption="您偏瘦了" & weightb - weight & "公斤!; 注意增加营养!"
Else
'Print "您的体重非常标准,请继续保持!"
label3.caption="您的体重非常标准,请继续保持!"
End If
End If
'//////把print语句注释掉,改成label3.caption=""/////
展开全部
Private Sub command1_click()
Dim weight, height, weightb As Integer
height = Val(Text1.Text)
weight = Val(Text2.Text)
weightb = (height - 100) * 0.9
Label3.Caption = "你的标准体重是:" & weightb
If weight > weightb Then
Label3.Caption = "您偏胖了" & (weight - weightb) & "公斤!" & "该减肥了!"
Else
If weight < weightb * 0.9 Then
Label3.Caption = "您偏瘦了" & weightb - weight & "公斤!" & "注意增加营养!"
Else
Label3.Caption = "您的体重非常标准,请继续保持!"
End If
End If
End Sub
Dim weight, height, weightb As Integer
height = Val(Text1.Text)
weight = Val(Text2.Text)
weightb = (height - 100) * 0.9
Label3.Caption = "你的标准体重是:" & weightb
If weight > weightb Then
Label3.Caption = "您偏胖了" & (weight - weightb) & "公斤!" & "该减肥了!"
Else
If weight < weightb * 0.9 Then
Label3.Caption = "您偏瘦了" & weightb - weight & "公斤!" & "注意增加营养!"
Else
Label3.Caption = "您的体重非常标准,请继续保持!"
End If
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-07-04 · 知道合伙人互联网行家
关注
展开全部
Private Sub Form_Load()
On Error GoTo qqq
Me.Text1.Text = ""
Open "c:\q.dat" For Input As #1
Do While Not EOF(1)
Line Input #1, temp
Me.Text1.Text = Me.Text1.Text & temp
Loop
Close
qqq:
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open "c:\q.dat" For Output As #1
Print #1, Me.Text1.Text
Close
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
label1.caption="您偏瘦了" & weightb - weight & "公斤!注意增加营养!"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询