在窗体上画一个名称为Command1的命令按钮,再画两个名称分别为Label1、Label2的标签,然后编写如下程序代码:
Private X As Integer
Private Sub Command1_Click()
X=5:Y=3
Call proc(X,Y)
Label1.Caption=X
Label2.Caption=Y
End Sub
Private Sub proc(a As Integer,ByVal b As Integer)
X=a*a
Y=b+b
End Sub
程序运行后,单击命令按钮,则两个标签中显示的内容分别是______。
谢谢,我懂了
本回答被提问者采纳vb程序 求解 求代码注释 谢谢
Private X As Integer '定义一个整数私有变量x Private Sub Command1_Click()'按钮单击过程 X=5:Y=3 '初始化 Call proc(X,Y) '呼叫子程序。2个整形传值参数,Label1.Caption=X Label2.Caption=Y End Sub Private Sub proc(a As Integer,ByVal b As Integer)X=a*a 'a=5,所以x=25...
vb程序 求代码注释 求答案 谢谢
Public x As Integer ’定义一个全局变量x Private y As Integer '定义一个模块级变量y 窗体文件的程序代码是:Dim a As Integer '定义一个模块级变量a Private Sub Form_Load()Dim b As Integer ‘定义一个局部变量b a=2:b=3:x=10:y=20 End Sub Private Sub Command1_Click()a...
vb程序 求代码注释,谢谢
FindMin函数是用来找到一个数组中最小的值 Private Function FindMin(a() As Integer)Dim Start As Integer Dim Finish As Integer, i As Integer Start = LBound(a) 得到该数组的下界 Finish = UBound(a)得到该数组的上界 Min = a(Start) 得到a数组的第一个元素 For i = Start To Finish ...
vb程序 求代码注释 谢谢
Dim a(5, 8) As Single, athlete(5) As String * 8 定义单精度浮点型数组A,第一维1-5,第二位1-8,定义8长度字符串数组第一维1-5 Private Sub Command1_Click()Dim ch As String 定义 Text1 = "" 置空文本框 Open App.Path & "\\in5.dat" For Input As #1 用“读”型打开程...
求VB代码希望有注释
Dim j Dim temp Dim temp2 j = 2 '定义开始的后面那个数值 For i = 2 To 6 '开始循环行 For temp = 1 To 5 '循环每个点 If temp >= i Then '判断是输出一还是后面的数值 temp2 = temp2 & i & " "Else temp2 = temp2 & "1 "End If Next temp Print temp2 ‘输出一行 te...
vb代码求注释呀,有个地方看不明白,求大神指点
For b = 2 To a - 1 If a Mod b = 0 Then Exit For End If Next b 这段代码,从2到a-1依次与a进行取余运算,只有当这所有取余结果都不为零(即不能整除)时,可判断a为素数。而这时,b刚好和a的值相等。 如果中途有任何一个数取余为零,立即中止判断(根据定义,只要有一个数能...
VB 求代码?最好有注释,谢谢!
For Each item In items '检索数组元素 If InStr(Text1.Text, item) > 0 Then 'text1中查找item Text = Text & vbCrLf & item '查找到即添加到text End If Next Text3.Text = Mid(Text, 3) '去除前面的回车换行符后赋给Text3End Sub ...
VB代码求注释2
End Sub '子程序结束 Private Sub print_Click()Dim firpage, endpage, num '定义变量 firpage,endpage,num cd.CancelError = True ' cd的CancelError=True On Error GoTo jj '当错误 跳至 jj cd.ShowPrinter ' cd的ShowPrinter num = cd.Copies 'num= cd的Copies Printer....
VB代码求注释
Private Sub Form_Activate() '当窗口激活时 SUCCESS = sndPlaySound(App.Path + "\\sound\\start.WAV", &H1) '把 SUCCESS 作为返回值 ,并执行 sndPlaySound 子程序或自定义函数 End Sub Private Sub Form_Load() '当窗口读取时 Load FrmSna '读取FRMSNA CTS = 1 '赋值1到CTS ...
求高手帮忙把下面的VB代码加上注释
Private Sub Command1_Click()a = ""If Trim(xm.Text) <> "" Then a = "where 姓名 like '%" + Trim(xm.Text) + "%'"End If If Trim(xh.Text) <> "" Then If a <> "" Then a = a + " or"Else a = a + "where"End If a = a + " 学号 like '%" + Trim(xh...