VB 已知几组数列,随机显示其中一组数列 最简哦!!已知几组数列,随机显示其中一组数列。 
问题补充:比如:
31asd2121
4123112aa
312312sdf
随机一组哦  最简哦!!

解决方案 »

  1.   

    31asd2121 
    4123112aa 
    312312sdf 
    随机一组哦
      

  2.   

    Dim intP as integer
    Dim strArray(0 to 2) as String 
    For intP=0 to 2
        Select Case IntP
            Case 0
              strArray(intP)="31asd2121"
            Case 1
              strArray(intP)="4123112aa"
            Case 2
              strArray(intP)="312312sdf"
        end Select
    Next intP
    intP=CInt(Rnd*2)
    Debug.print strArray(intP)
      

  3.   

    Option Explicit
    Dim intNow As Integer
    Dim intOld As Integer
    Private Sub Command1_Click()
        Dim intP As Integer
        Dim strArray(0 To 2) As String
    On Error GoTo errSub
        For intP = 0 To 2
            Select Case intP
                Case 0
                  strArray(intP) = "31asd2121"
                Case 1
                  strArray(intP) = "4123112aa"
                Case 2
                  strArray(intP) = "312312sdf"
            End Select
        Next intP
        Do
            intNow = CInt(Rnd * 2)
        Loop Until intNow <> intOld
        intOld = intNow
        Debug.Print strArray(intNow)
        Exit Sub
    errSub:
        Debug.Print Err.Description
    End SubPrivate Sub Form_Load()
        intNow = -1
        intOld = -1
    End Sub
      

  4.   


    dim i as long
    dim arr
    dim idx as long
    dim n as longarr=array( "31asd2121","4123112aa","312312sdf")
    n=ubound(arr)
    randomize 
    for i=0 to n
        idx=int((n-i+1)*rnd+i)
        debug.print arr(idx)
        arr(idx)=arr(i)
    next