打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
用VB编写的双色球选号程序
userphoto

2019.04.12

关注

        

程序简要介绍:

   新建一个窗体,在该窗体内放入9个标签控件,其中label2--label8分别放入选出的号码;有一个组合框控件,准备存入每次选中的号码;两个命令按钮,分别为“开始选号”与“退出”。

代码如下:

Option Explicit
Private SubCommand1_Click()    '开始选号
   Dim q As Integer
   Dim a As Integer
   Dim b As Integer
   Dim c As Integer
   Dim d As Integer
   Dim e As Integer
   Dim f As Integer
   Dim g As Integer
  
   For q = 1 To 7
      Select Case q
         Case 1
             Randomize (Time)
             a = Int(Rnd * 33 + 1)
             Label2.Caption = a
         
         Case 2
            Do
               Randomize (Time)
               b = Int(Rnd * 33 + 1)
            Loop Until b <> Label2.Caption
            Label3.Caption = b
            
          Case 3
            Do
               Randomize (Time)
               c = Int(Rnd * 33 + 1)
            Loop Until c <> Label2.Caption And c<> Label3.Caption
            Label4.Caption = c
            
           Case 4
            Do
               Randomize (Time)
               d = Int(Rnd * 33 + 1)
            Loop Until d <> Label2.Caption And d<> Label3.Caption And d<> Label4.Caption
            Label5.Caption = d
  
           Case 5
            Do
               Randomize (Time)
               e = Int(Rnd * 33 + 1)
            Loop Until e <> Label2.Caption And e<> Label3.Caption And e<> Label4.Caption And e<> Label5.Caption
            Label6.Caption = e
  
           Case 6
            Do
               Randomize (Time)
               f = Int(Rnd * 33 + 1)
            Loop Until f <> Label2.Caption And f<> Label3.Caption And f<> Label4.Caption And f<> Label5.Caption And f<> Label6.Caption
            Label7.Caption = f
  
  
           Case 7
              Randomize (Time)
              g = Int(Rnd * 16 + 1)
              Label8.Caption = g
           Case Else
        End Select
     Next q
        
         Dim w  AsVariant      '在组合框内添加选出的号码
            w = a & "  " & b& "  " & c& "  " & d& "  " & e& "  " & f& "--" & g
         Combo1.Text = w
         Combo1.AddItem w, 0
         
        
  
  
End Sub

Private Sub Command2_Click()  '退出程序
  End
End Sub

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
十个随机数排列(vb代码)
《Visual Basic程序设计(第4版)》第7章 数 组
VB控件数组的操作技巧
vb简谱播放代码
如何让窗体中的标签文本移动
利用四种循环求解10!的阶乘程序问题
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服