Private Sub Command1_Click()
'On Error Resume Next
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim e As Integer
Dim f As Integer
Dim g As Integer
Dim h As Integer
Dim x(4) As Single
x(1) = Text1.Text
x(2) = Text2.Text
x(3) = Text3.Text
x(4) = Text4.Text
List1.Clear
For e = 1 To 4
  For f = 1 To 4
    If e <> f Then
       For g = 1 To 4
         If g <> e And g <> f Then
            For h = 1 To 4
               If h <> g And h <> f And h <> e Then
               
For a = 1 To 4
   For b = 1 To 4
      For c = 1 To 4
        If twoNum(twoNum(x(e), x(f), a), twoNum(x(g), x(h), b), c) = 24 Then List1.AddItem twoStr(twoStr(x(e), x(f), a), twoStr(x(g), x(h), b), c)
        If twoNum(x(e), twoNum(x(f), twoNum(x(g), x(h), c), b), a) = 24 Then List1.AddItem twoStr(x(e), twoStr(x(f), twoStr(x(g), x(h), c), b), a)
            If twoNum(x(e), twoNum(twoNum(x(f), x(g), c), x(h), b), a) = 24 Then List1.AddItem twoStr(x(e), twoStr(twoStr(x(f), x(g), c), x(h), b), a)
        If twoNum(twoNum(twoNum(x(e), x(f), a), x(g), b), x(h), c) = 24 Then List1.AddItem twoStr(twoStr(twoStr(x(e), x(f), a), x(g), b), x(h), c)
            If twoNum(twoNum(x(e), twoNum(x(f), x(g), a), b), x(h), c) = 24 Then List1.AddItem twoStr(twoStr(x(e), twoStr(x(f), x(g), a), b), x(h), c)
      'List1.AddItem twoStr(twoStr(x(e), x(f), a), twoStr(x(g), x(h), b), c) & "=" & twoNum(twoNum(x(e), x(f), a), twoNum(x(g), x(h), b), c)
      Next
   Next
Next
               
               End If
            Next
          End If
        Next
      End If
    Next
 Next
            
        
End SubPrivate Sub Form_Load()
Randomize
Text1.Text = Int(Rnd * 10) + 1
Text2.Text = Int(Rnd * 10) + 1
Text3.Text = Int(Rnd * 10) + 1
Text4.Text = Int(Rnd * 10) + 1
End Sub
Function twoNum(one As Single, two As Single, i As Integer) As Single
On Error Resume Next
Select Case i
   Case 1
      twoNum = one + two
    Case 2
twoNum = one - two
Case 3
twoNum = one * two
Case 4
twoNum = one / two
End Select
End FunctionFunction twoStr(ones As String, twos As String, i As Integer) As String
On Error Resume NextSelect Case i
Case 1
twoStr = "(" & one & "+" & two & ")"
Case 2
twoStr = "(" & one & "-" & two & ")"
Case 3
twoStr = one & "*" & two
Case 4
twoStr = one & "/" & two
End Select
End Function
运行的话,会出现错误:ByRef 参数类型不符
搞了一个晚上还是不知道怎么搞,请问该怎样修改一下代码,谢谢大家了