把下面的代码复制到记事本中,改名为form1frm,再用vb6打开编译即可使用。希望你能喜欢,不足之处可以提出来。
VERSION 500
Begin VBForm Form1
BorderStyle = 5 'Sizable ToolWindow
Caption = "**选号程序"
ClientHeight = 3855
ClientLeft = 60
ClientTop = 330
ClientWidth = 6600
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3855
ScaleWidth = 6600
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VBFrame Frame4
Caption = "号码框"
Height = 2415
Left = 3600
TabIndex = 11
Top = 1320
Width = 2895
Begin VBCommandButton Command6
Caption = "输入号码"
Height = 255
Left = 1560
TabIndex = 19
Top = 720
Width = 1095
End
Begin VBCommandButton Command5
Caption = "试试运气"
Height = 495
Left = 120
TabIndex = 16
Top = 1440
Width = 2535
End
Begin VBTextBox xx
Height = 270
Left = 1560
TabIndex = 14
Top = 1080
Width = 1095
End
Begin VBTextBox sx
Height = 270
Left = 120
TabIndex = 13
Top = 1080
Width = 1095
End
Begin VBLabel Label5
Caption = "范围:"
Height = 255
Left = 120
TabIndex = 18
Top = 720
Width = 615
End
Begin VBLabel Label4
Caption = "机选号码:"
Height = 255
Left = 120
TabIndex = 17
Top = 2040
Width = 2535
End
Begin VBLabel Label3
Caption = "~"
BeginProperty Font
Name = "宋体"
Size = 1425
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 135
Left = 1320
TabIndex = 15
Top = 1200
Width = 255
End
Begin VBLabel Label2
Caption = "我的号码:"
Height = 255
Left = 120
TabIndex = 12
Top = 360
Width = 2655
End
End
Begin VBFrame Frame3
Caption = "统计框"
Height = 975
Left = 3600
TabIndex = 8
Top = 240
Width = 2895
Begin VBCommandButton Command3
Caption = "点我统计!"
Height = 615
Left = 120
TabIndex = 9
Top = 240
Width = 2655
End
End
Begin VBFrame Frame2
Caption = "查找框"
Height = 2415
Left = 120
TabIndex = 3
Top = 1320
Width = 3375
Begin VBCommandButton Command4
Caption = "清除"
Height = 255
Left = 2400
TabIndex = 10
Top = 2040
Width = 855
End
Begin VBCommandButton Command2
Caption = "查找"
Height = 255
Left = 2520
TabIndex = 7
Top = 240
Width = 735
End
Begin VBListBox List1
Height = 1320
ItemData = "Form1frx":0000
Left = 120
List = "Form1frx":0002
TabIndex = 5
Top = 600
Width = 3135
End
Begin VBTextBox Text1
Height = 270
Left = 120
TabIndex = 4
Top = 240
Width = 2295
End
Begin VBLabel Label1
Caption = "总共:0项"
Height = 255
Left = 120
TabIndex = 6
Top = 2040
Width = 2175
End
End
Begin VBFrame Frame1
Caption = "输入框"
Height = 1095
Left = 120
TabIndex = 0
Top = 120
Width = 3375
Begin VBTextBox Text2
Height = 270
Left = 120
TabIndex = 2
Top = 240
Width = 3135
End
Begin VBCommandButton Command1
Caption = "输入并确定"
Height = 375
Left = 120
TabIndex = 1
Top = 600
Width = 3135
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim N As Long
Dim NR As String
Dim ZS As Long
Dim CS As Long
Dim mynum As Long
Private Sub Command1_Click()
Open "C:\1TXT" For Append As #1
Print #1, Val(Text2Text)
Close #1
Label2Caption = "我的号码:" & Val(Text2Text)
mynum = Val(Text2Text)
Text2Text = ""
End Sub
Private Sub Command2_Click()
CS = CS + 1
Open "C:\1TXT" For Input As #1
Do While Not EOF(1)
Line Input #1, NR
NR = Trim(NR)
If NR = Text1Text Then List1AddItem NR: N = N + 1
Loop
Close #1
List1AddItem "------------第" & CS & "次------------"
Label1Caption = "总共:" & N & "项"
N = 0
NR = ""
End Sub
Private Sub Command3_Click()
Open "C:\1TXT" For Input As #1
Do While Not EOF(1)
Line Input #1, NR
NR = Trim(NR)
If NR = NR Then ZS = ZS + 1
Loop
Close #1
MsgBox "共有" & ZS & "项"
ZS = 0
End Sub
Private Sub Command4_Click()
List1Clear
End Sub
Private Sub Command5_Click()
Label4Caption = "机选号码:" & Int(Rnd Val(sxText)) + Val(xxText)
End Sub
Private Sub Command6_Click()
mynum = InputBox("输入号码:")
Label2Caption = "我的号码:" & mynum
End Sub
Private Sub Form_Load()
N = 0
End Sub
用VB实现上述功能的函数是:
Function fun(m, n) As Integer
Sum = 0
For i = 1 To 100
If i Mod m = 0 Or i Mod n = 0 Then
Sum = Sum + i
End If
Next i
fun = Sum
End Function
Private Sub Command1_Click()
m = CInt(InputBox("m="))
n = CInt(InputBox("n="))
Print "100以内能被"; m; "或"; n; "整除的数的总和="; fun(m, n)
End Sub
Private Sub Command1_Click()
Dim a, b, c As Integer
Dim aconst, bconst As Integer
Dim sum As Integer
aconst = Int((100 - (100 / 3)) / 5) + 1
For a = 0 To aconst
bconst = Int((100 - a 5) / 3) + 1
For b = 0 To bconst
c = 100 - a - b
If Not (c Mod 3) Then
sum = a 5 + 3 b + c / 3
If sum = 100 Then
Print "公鸡" & a, "母鸡" & b, "小鸡" & c
ElseIf sum > 100 Then
Exit For
End If
End If
Next
Next
End Sub
a=val(inputbox("请输入款项"))
if a>=500 then
a=a08
elseif a>=200 and a<500 then
a=a09
end if
msgbox “需要支付" & a &“元”
以上就是关于用VB写个彩票选号程序,求思路!全部的内容,包括:用VB写个彩票选号程序,求思路!、用vb编写程序、VB 编写程序解决百钱买百鸡问题等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)