永发信息网

VB 三个数字排序,有三个text,用于输入,另三个box用于输出

答案:2  悬赏:40  手机版
解决时间 2021-01-27 20:05
  • 提问者网友:饥饿走向夜
  • 2021-01-27 16:15
Private Sub Command1_Click()
Dim a As Single
Dim b As Single
Dim c As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a > b Then
If b > c Then Text4.Text = Format(a): Text5.Text = Format(b): Text6.Text = Format(c)
Else: If a > c Then Text4.Text = Format(a): Text5.Text = Format(c): Text6.Text = Format(b)
Else: Text4.Text = Format(c): Text5.Text = Format(a): Text6.Text = Format(b)
End If

Else: If b < c Then Text4.Text = Format(c): Text5.Text = Format(b): Text6.Text = Format(a)
Else: If a > c Then Text4.Text = Format(b): Text5.Text = Format(a): Text6.Text = Format(c)
Else: Text4.Text = Format(b): Text5.Text = Format(c): Text6.Text = Format(a)
End If
End If

End Sub
不知道哪里出错了。。。。。
最佳答案
  • 五星知识达人网友:荒野風
  • 2021-01-27 16:49
Private Sub Command1_Click()
Dim a As Single
Dim b As Single
Dim c As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a > b Then
If b > c Then
Text4.Text = Format(a)
Text5.Text = Format(b)
Text6.Text = Format(c)
Else
If a > c Then
Text4.Text = Format(a)
Text5.Text = Format(c)
Text6.Text = Format(b)
Else
Text4.Text = Format(c)
Text5.Text = Format(a)
Text6.Text = Format(b)
End If
End If
Else
If b < c Then
Text4.Text = Format(c)
Text5.Text = Format(b)
Text6.Text = Format(a)
Else
If a > c Then
Text4.Text = Format(b)
Text5.Text = Format(a)
Text6.Text = Format(c)
Else
Text4.Text = Format(b)
Text5.Text = Format(c)
Text6.Text = Format(a)
End If
End If
End If
End Sub
将它复制回去,省得出错。
全部回答
  • 1楼网友:青尢
  • 2021-01-27 17:29
我不会~~~但还是要微笑~~~:)
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯