现在有6个label
要求把A B C D E F    6个人随机编排到6个label中去
 不知道该怎么弄。。希望有人能教教我

解决方案 »

  1.   

    思路:将这些人名编个号,比如1-6.然后使用RND语句生成一个6以内的随机整数,再填到LABEL里就可以了
      

  2.   

    2楼的不行~!
        6个LABEL会出现重复的  自己忙了一晚上搞定了、 前面的和2楼一样,后面用了6个selectcase控制编排,每个控制一个LABEL。用while wend来控制不出现重复,具体就是1个随机数对应1个名字,都用while来判断名字是否重复。
     感觉6个名字还吃的消。多到几十个就顶不住了。。因为我这样是一对一来弄的
      

  3.   

    放源码上来给各位看看。VB写的第一个程序!虽然很烂,但是心里感觉蛮不错的Private Sub Command1_Click()
    Dim a, b, c, d, e, f As Integer, a1, b1, c1, d1, e1, f1 As String
    Beep
    Randomize
    a = Int(6 * Rnd) + 1
    b = Int(6 * Rnd) + 1
    c = Int(6 * Rnd) + 1
    d = Int(6 * Rnd) + 1
    e = Int(6 * Rnd) + 1
    f = Int(6 * Rnd) + 1
    While a = b Or a = c Or a = d Or a = e Or a = f Or b = c Or b = d Or b = e Or b = f Or c = d Or c = e Or c = f Or d = e Or d = f Or e = f
      Randomize
      a = Int(6 * Rnd) + 1
      b = Int(6 * Rnd) + 1
      c = Int(6 * Rnd) + 1
      d = Int(6 * Rnd) + 1
      e = Int(6 * Rnd) + 1
      f = Int(6 * Rnd) + 1
    Wend
    Select Case a
      Case 1
        a1 = "陆忠仁"
      Case 2
        a1 = "徐乐天"
      Case 3
        a1 = "吴涛"
      Case 4
        a1 = "何涛"
      Case 5
        a1 = "陈斌"
      Case 6
        a1 = "姚学铸"
    End Select
    Select Case b
      Case 1
        b1 = "陆忠仁"
      Case 2
        b1 = "徐乐天"
      Case 3
        b1 = "吴涛"
      Case 4
        b1 = "何涛"
      Case 5
        b1 = "陈斌"
      Case 6
        b1 = "姚学铸"
    End SelectSelect Case c
      Case 1
        c1 = "陆忠仁"
      Case 2
        c1 = "徐乐天"
      Case 3
        c1 = "吴涛"
      Case 4
        c1 = "何涛"
      Case 5
        c1 = "陈斌"
      Case 6
        c1 = "姚学铸"
    End SelectSelect Case d
      Case 1
        d1 = "陆忠仁"
      Case 2
        d1 = "徐乐天"
      Case 3
        d1 = "吴涛"
      Case 4
        d1 = "何涛"
      Case 5
        d1 = "陈斌"
      Case 6
        d1 = "姚学铸"
    End SelectSelect Case e
      Case 1
        e1 = "陆忠仁"
      Case 2
        e1 = "徐乐天"
      Case 3
        e1 = "吴涛"
      Case 4
        e1 = "何涛"
      Case 5
        e1 = "陈斌"
      Case 6
        e1 = "姚学铸"
    End SelectSelect Case f
      Case 1
        f1 = "陆忠仁"
      Case 2
        f1 = "徐乐天"
      Case 3
        f1 = "吴涛"
      Case 4
        f1 = "何涛"
      Case 5
        f1 = "陈斌"
      Case 6
        f1 = "姚学铸"
    End Select
    Label5.Caption = a1
    Label6.Caption = b1
    Label7.Caption = c1
    Label9.Caption = d1
    Label10.Caption = e1
    Label11.Caption = f1
      

  4.   

    假如有1000个人名 你要case 1000个条件啊
      

  5.   

    将所有待选项添加到集合 oNames 中,然后:While oNames.Count >0
      i = Int(rnd() * oNames.Count)+1
      debug.print oNames(i)
      oNames.Remove i
    Wend