请帮忙做个VB题!有参考代码
来源:百度知道 编辑:UC知道 时间:2024/07/06 12:53:35
-----------------------------------
Private Sub Command1_Click()
Dim x As Single, y As Single
x = Val(Text1.Text)
If x < 200 Then
y = x
Else
If x < 400 Then
y = 0.95 * x
Else
If x < 800 Then
y = 0.9 * x
Else
y = 0.8 * x
End If
End If
End If
Text2.Text = y
End Sub
麻烦大家了
Private Sub Command1_Click()
Dim x As Single, y As Single
x = Val(Text1.Text)
If x < 200 Then
y = x
Else
If x < 400 Then
y = 0.95 * x
Else
If x < 600 Then
y = 0.9 * x
else
If x < 1000 Then
y = 0.8 * x
Else
y = 0.7 * x
End If
End If
End If
end if
Text2.Text = y
End Sub
Private Sub Command1_Click()
If Val(Text1.Text) <= 200 Then
Text2.Text = "200"
ElseIf Val(Text1.Text) > 200 And Val(Text1.Text) <= 400 Then
Text2.Text = Val(Text1.Text) * 0.95
ElseIf Val(Text1.Text) > 400 And Val(Text1.Text) <= 600 Then
Text2.Text = Val(Text1.Text) * 0.9
ElseIf Val(Text1.Text) > 600 And Val(Text1.Text) <= 1000 Then
Text2.Text = Val(Text1.Text