永发信息网

VB.NET中,比较四个数字的大小 代码

答案:2  悬赏:70  手机版
解决时间 2021-03-27 06:12
  • 提问者网友:骑士
  • 2021-03-26 11:51
VB.NET中,比较四个数字的大小 代码
最佳答案
  • 五星知识达人网友:撞了怀
  • 2021-03-26 12:00
Function Test(ByVal i1 As Double, ByVal i2 As Double, ByVal i3 As Double, ByVal i4 As Double) As String
Dim nList As New List(Of Double)
nList.Add(i1)
nList.Add(i2)
nList.Add(i3)
nList.Add(i4)
Dim l = From item In nList Order By item
Dim s As String
Dim isFirst As Boolean = True
For Each i In l
If isFirst Then
isFirst = False
s = i
Else
s = s & "<= " & i
End If
Next
Return s
End Function
全部回答
  • 1楼网友:西风乍起
  • 2021-03-26 13:38
用不到2个命令按钮 1个就够
在按钮的过程中写如下代码
dim x as long , y as long ,z as long ,j as long ,n as long
dim k as integer
x = val(text1.text)
y = val(text2.text)
z = val(text3.text)
j = val(text4.text)
if x = then k = k+1
if y= then k = k+1
if z= then k = k+1
if j= then k = k+1
' 若输入的数有负数 则必须先在这里写下 n=-.....()
do
if x <>0 and n = x then
text5.text = text5.text &" " & x
k = k +1
end if
if y <>0 and n = then
text5.text = text5.text &" " & y
k = k +1
end if
if z <>0 and n = z then
text5.text = text5.text &" " & z
k = k +1
end if
if j <>0 and n = j then
text5.text = text.text &" " & j
k = k +1
end if
if k = 4 then exit for
n=n+1
loop

这是VB的代码。。。。 不知道.net 适用不
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯