求vb编程高手,谢谢了
dim s as integer, i as integer
s=0
for i=1 to 100
s=s+i
next i
print s
Private Sub Text1_Change()
Dim i As Integer, j As Integer, T As String
Label1.Caption = ""
For i = 1 To Len(Text1)
T = Mid(Text1, i, 1)
If Mid(Text1, i, 1) Like "[A-Z]" Then T = LCase(T): j = j + 1
If Mid(Text1, i, 1) Like "[a-z]" Then T = UCase(T): j = j + 1
Label1.Caption = Label1.Caption & T
Next
Label2.Caption = j
End Sub
我以前做过一个
界面没法发给你 你看怎么办
Dim a%, b%, c%, d$, e!, f!, a1, b1, chushu
Private Sub Command1_Click()
If Label4 >= 15 Then
msg = MsgBox("每次连续运算不能超过15次", 0, "提示")
Else
f = Val(Text1)
dayin = Label1.Caption & f & " 对了"
dayin1 = Label1.Caption & f & " 错了"
If f = Val(Text2.Text) Then
Picture1.Print dayin
Label6 = Label6 + 1
Label4 = Label4 + 1
Else
Picture1.Print dayin1
Label9 = Label9 + 1
Label4 = Label4 + 1
End If
Command2.Enabled = True
Text1 = ""
Form_Load
End If
End Sub
Private Sub Command2_Click()
If Val(Label4) > 0 Then
zql = Val(Label6) / Val(Label4)
zql1 = Val(Left(zql, 4)) * 100 & "%"
Picture1.Print "************************************"
Picture1.Print "正确率是" & zql1
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Command3_Click()
Command3.Caption = "重来"
Picture1.Cls
Text1 = ""
Text2 = 0
Label1 = ""
Label4 = 0
Label6 = 0
Label9 = 0
Command2.Enabled = False
Command1.Enabled = True
Form_Load
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Form_Load()
Randomize
If Command3.Caption <> "开始" Then
a = Int(Rnd * 60 + 1) + Int(Rnd * 40 + 1)
b = Int(Rnd * 30 + 1) + Int(Rnd * 70 + 1)
c = Int(Rnd * 4 + 1)
a1 = Int(Rnd * 10 + 1)
b1 = Int(Rnd * 10 + 1)
If c = 1 Then
d = "+": e = a + b
ElseIf c = 2 Then
d = "-": e = a - b
ElseIf c = 3 Then
d = "×": e = a * b
Else
chushu = a1 / b1
d = "÷": e = Val(Left(chushu, 3))
End If
If d <> "÷" Then
Label1.Caption = a & d & b & "="
Else
Label1.Caption = a1 & d & b1 & "="
End If
Text2 = e
Else
End If
End Sub
Command1 仅此一个开始
Label1 显示题号
Label2 显示四则运算
Label3 正确、错误 准确率
List1 答题纪录
Dim cont, con1, ddd, bbb, ccc As Integer
Private Sub Command1_Click()
Randomize
cont = cont + 1
Label1.Caption = "第" & cont & "题"
aaa = Int(Rnd * 4 + 1)
Select Case aaa
Case 1
bbb = Int(Rnd * 99 + 1)
ccc = Int(Rnd * 99 + 1)
ddd = bbb + ccc
Label2.Caption = bbb & " + " & ccc & " = "
Case 2
bbb = Int(Rnd * 99 + 1)
ccc = Int(Rnd * 99 + 1)
ddd = bbb - ccc
Label2.Caption = bbb & " - " & ccc & " = "
Case 3
Do
bbb = Int(Rnd * 99 + 1)
ccc = Int(Rnd * 99 + 1)
ddd = bbb * ccc
Loop Until ddd <= 200
Label2.Caption = bbb & " * " & ccc & " = "
Case 4
Do
bbb = Int(Rnd * 99 + 1)
ccc = Int(Rnd * 99 + 1)
ddd = bbb / ccc
eee = ddd - Int(ddd)
Loop Until eee = 0
Label2.Caption = bbb & " / " & ccc & " = "
End Select
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If ddd = Val(Text1.Text) Then
List1.AddItem "第" & cont & "题答对 " & Label2.Caption & " " & ddd
con1 = con1 + 1
Else
List1.AddItem "第" & cont & "题答错 " & Label2.Caption & " " & Text1.Text & " 正确答案 " & ddd
End If
Label3.Caption = "共答" & cont & "题 答对" & con1 & "题 准确率 " & Int(con1 / cont * 100) & "%"
Command1_Click
End If
End Sub
本人有一个问题想问,请VB编程高手帮个忙!急
本函数还可以用来连接到网页:ShellExecute 0&, vbNullString, "http:\/\/coolbasic.yeah.net", vbNullString, vbNullString, vbNormalFocus 或者这样写来发送Email:ShellExecute me.hwnd, "open", "mailto:vbcode@vbcode.com", vbNullString, vbNullString, SW_SHOW 另外有ShellExecute的替代用法,...
VB编程的高手们,跪求了
w = InputBox("请输入需要转换的温度:"&vbcrlf&_"例如:"&vbcrlf&"101F中的F表示华氏温度"&vbcrlf&_"30C中的C表示摄氏温度",,"115F")wz = Left(w,Len(w)-1)If IsNumeric(wz) Then wz = CSng(wz)If Right(w,1) = "F" Then wz = (wz-50)*5\/9+10 MsgBox w&" → "&Roun...
VB编程高手进
例如,单击或双击一个控件、在控件中选择部分文本、操作控件的滚动条都会产生通知消息。 Button BN_CLICKED 用户单击了按钮 BN_DISABLE 按钮被禁止 BN_DOUBLECLICKED 用户双击了按钮 BN_HILITE 用户加亮了按钮 BN_PAINT 按钮应当重画 BN_UNHILITE 加亮应当去掉 ComboBox CBN_CLOSEUP 组合框的列表框被关闭 CBN_DBLCLK...
vb高手请进!帮编写个程序!急求!
Private Sub Command1_Click()Cls Dim s(1 To 20) As Integer, sum As Long Print "随机20个整数:"For i = 1 To 20 s(i) = Int(Rnd * 100 + 100)n = n & s(i) & ","Next Print n Print "能被7整除的数:"For j = 1 To 20 If s(j) Mod 7 = 0 Then sum = sum...
关于VB编程,求助高手,高分!!!
Private Sub Form_Load()Dim A(4, 4) As Integer, B(4, 4) As Integer, C(4, 4) As Integer, i%, j Randomize For i = 1 To 4 For j = 1 To 4 A(i, j) = Int(Rnd * 41 + 30)B(i, j) = Int(Rnd * 35 + 101)C(i, j) = A(i, j) + B(i, j)Print A...
新手学VB编程 高手进!
print a;"*";b;"=";c 第一句:a是一个变量,给它赋值2 说明:(1)变量是一个代号,它好像方程中的x一样能代表不同的数、值。(2)等号(=)是一个赋值符号,它是让等号左边的变量等于右边的值(注意一定是一个有确定值的数字或变量)。a=2赋值后,以后再用到2,可以用a代替,以后若再...
vb编程急求嘤嘤嘤求大神帮助呀
Private Sub Command1_Click() Dim x As Integer x = InputBox("请输入您的数:") Print "您输入的数有:" & x; Max = x: Min = x: Sum = x For i = 2 To 10 x = InputBox("请输入您的数:"): Print x; Sum = Sum + x If x > Max Then Max = x ...
请学霸大佬帮我解决一下这个vb编程,谢谢!
n, 1) If n = Len(strS) Then Timer1.Interval = 0 Timer2.Interval = 100 End IfEnd SubPrivate Sub Timer2_Timer() If t Mod 2 = 0 Then Label1.BackColor = vbBlack Else Label1.BackColor = vbWhite End If t = t + 1End Sub Private Sub Form_Load...
急求懂VB的朋友!!!谢谢
第一题,创建textbox一个,commandbutton一个,复制下面代码即可:Option Explicit Private Sub Command1_Click()Dim i As Integer Dim lngSum As Long Dim intN As Integer intN = Val(InputBox("N", "输入", "50"))For i = 1 To intN lngSum = lngSum + i Next Text1.Text = lngSum...
求VB大神,明早急用啊,辛苦一下,谢谢了!!!
Private Sub Command1_Click()Dim i As Long, n As Long n = Val(InputBox("整数N", "输入", 100))If n <= 1 Then Exit Sub For i = 1 To n \\ 2 If n Mod i = 0 Then Print CStr(n) & "能被" & CStr(i) & "整除"Next i End Sub Private Sub Command2_Click()Dim...
晨哀欧意: VB入门容易,但是写好程序很难! 我总结的结论是: 1 多收集控件:例如 Fastreport3.dll Grid 2 多收集典型例子:例如 注册表 API 3 自己把这些事例整合在自己的程序中,需要的时候自己复制就可以,不会的可以去网上搜索 4 如果学习.net 你可以参照C# 等程序,进行修改几乎属性一样,只不过语法有些变动 入门的话,就写几个逻辑判断 数据库管理 和普通控件的使用而已!祝你学好VB
贵州省17166627699: 求VB高手编程 - ?
晨哀欧意: Visual Basic.NET 是从 Visual Basic 语言演变而来的,是一种为高效地生成类型安全和面向对象的应用程序而设计的语言.Visual Basic 允许开发人员开发面向 Windows、Web 和移动设备的程序.与所有面向 Microsoft .NET Framework 的语言...
贵州省17166627699: 求一个vb的编程高手来帮忙啊?
晨哀欧意: Dim i As Integer, a(20) As Integer Dim max As Integer, mix As Integer Dim sum As Integer Private Sub Command1_Click() Randomize max = a(1) mix = a(1) For i = 1 To 20 a(i) = Int(Rnd * 40) + 60 List1.AddItem a(i) If a(i) > max Then max = a(i) End ...
贵州省17166627699: 急需VB高手编写程序?
晨哀欧意: dim aa dim bb sub getnum() aa=inputbox("请输入10个数字,用“;”分开:") bb=split(aa,";",-1,1) if ubound(bb)+1<10 then kk=msgbox("你输入的数字小于10个,请重新输入!") getnum end if if ubound(bb)+1>10 then msgbox("你...
贵州省17166627699: VB编程,求高手指教! - ?
晨哀欧意: rs3.Open( "Select * From dbuser Where User_nb= '" & TextUserName & "'", cn, adOpenKeyset, adLockPessimistic) 加个括号!如果不对检查你的cn.把你的ConnectionStrings放上来看看. 你的Select 语句如果在vb6.0是正确的.如果是在.net中用TextUserName是取不到值的.后面要加(Text)TextUserName.Text
贵州省17166627699: 求高手编写VB程序!!?
晨哀欧意: Private Sub Form_Click() Dim i As Integer, s As Integer, y As Double For i = 1 To 9 s = s + i y = y + 1 / s Next i Print y End Sub
贵州省17166627699: vb编程高手 ~急求!! - ?
晨哀欧意: 我的调试通过了,结果都算出来了:25、36、625Dim i As IntegerFor i = 2 To 999If Val(Right(Str(i ^ 2), 1)) ^ 2 = i ThenPrint iEnd IfNext iFor i = 2 To 999If Val(Right(Str(i ^ 2), 2))...
贵州省17166627699: 跪求编程高手给个vb程序设计实例,时间比较赶,望速度,谢谢?
晨哀欧意: 拼图啊! '添加一个名为label1的标签控件,并将其index设为0;再添加一个名为command1的按钮控件 Dim a(1 To 9) As Boolean Dim win As Boolean, begin As Boolean, haveload As Boolean, start As Boolean Private Sub Command1_Click() ...
贵州省17166627699: 程序设计,vb 求高手解答.谢谢了(要求用inputBox 输入一个正实数,用msgbox输出它的平方和平方根 ,要求每个数保留三位小数. 知识点:InputBox函... - ?
晨哀欧意:[答案] Private Sub Command1_Click() Dim x As Single x = Val(InputBox("输入一个正实数")) MsgBox Round(x, 3) & vbCrLf & "平方=" & Round(x * x, 3) & vbCrLf & "平方根=" & Round(Sqr(x), 3) End Sub
贵州省17166627699: 求VB程序设计高手?
晨哀欧意: Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Private Sub Drive1_Change() Dir1.Path = Drive1.Drive End Sub Private Sub File1_Click() Image1.Picture = LoadPicture(File1.Path + "\" + File1.List(File1.ListIndex)) Text1.Text = File1....