太原理工大学vb 考试试题
更新时间:2023-11-12 00:33:01 阅读量: 教育文库 文档下载
- 太原理工大学vb重修卷子推荐度:
- 相关推荐
VB程序设计作业
学号:s20090679____ 姓名: 冯伟___
一、基本概念题
1.Visual Basic6.0有多种类型的窗口,若要在设计时看到代码窗口,应怎样操作?
答:打开代码设计窗口的操作是:双击窗体、控件,或单击工程资源管理器窗口的“查看代码”按钮。
2.叙述建立一个完整应用程序的过程。
答:建立一个完整应用程序的过程分为以下几个步骤:
①建立用户界面的对象;②设置对象的属性;③对象事件过程及编程;④运行和调试程序。
3.当建立好一个简单的应用程序后,假定该工程仅有一个窗体模块,试问该工程涉及多少个要保存的文件?若要保存该工程中的所有文件,应先保存什么文件,在保存什么文件?
答:仅有一个窗体模块的工程涉及到需要保存的文件有窗体文件和工程文件。
在保存该工程中的所有文件时,应先保存窗体文件后保存工程文件。
4.命令按钮的显示形式可以有标准的和图形的两种选择,它们通过什么属性设置?若选择图形的,则通过什么属性装入图形?若已在规定的属性里装入了某个图形文件,但命令按钮还是不能显示该图形,而显示的是Caption属性设置的文字,应怎样修改?
答:命令按钮的显示形式是通过Style属性设置的。若选择图形的,则通过
Picture属性装入图形。若已在规定的属性里装入了某个图形文件,但命令按钮还是不能显示该图形,而显示的是Caption属性设置的文字,应将Style属性设置为1 。
5.在程序运行前,对某些控件设置属性值,除了在属性窗口中设置外,还可以通过代码设置,这些代码一般放置在什么事件过程中?如果要将命令按钮Command1定位在窗体的中央,试写出事件过程代码?
答:控件属性值的代码一般放置在单击(Click)事件过程中。
要将命令按钮Command1定位在窗体的中央,其事件过程代码为: Private Sub Command1_Click ()
Command1.Top = (Form1.ScaleHeight - Command1.Height) / 2 Command1.Left = (Form1.ScaleWidth - Command1.Width) / 2 End Sub
6.将数字字符串转换成数值,使用什么函数?判断是否是数字字符,使用什么函数?取字符串中的某几个字符,使用什么函数?实现大小写字母转换,使用什么函数?
答:在VB中,使用Val函数将数字字符串转换成数值,使用VarType函数
可判断是否是数字字符,取字符串中的某几个字符,使用Mid(C,N1[,N2])函数,实现大小写字母转换,使用LCase(C)函数。
7.Msgbox函数与Inputbox函数之间有什么区别?各自获得什么值?
答:①Inputbox函数是打开一个对话框,等待用户输入内容;Msgbox函数
是打开一个消息框,等待用户选择一个按钮。②Inputbox函数当用户单击“确定”按钮或按回车键后函数返回输入的值,其值类型为字符串;Msgbox函数返回用户所选按钮的整数值,决定程序执行的流程。③Msgbox函数过程没有返回
值,调用时不能有括号,作为一句独立的语句,常用于信息提示,不改变程序的流程;Inputbox函数过程有返回值,调用时有括号。
Inputbox函数获得的事字符串,Msgbox函数获得的是用户所选按钮的整数值。
8.什么是形参?什么是实参?什么是值引用?什么是地址引用?地址引用时,对应的实参有什么限制?
答:①形参:即形式参数,是在用户自定义函数过程,子过程过程名后圆括
号中出现的变量名,只能是变量或数组名,用于在调用该函数时的数据传递; ②实参:即实际参数,是在调用函数过程时,在过程名后参数,其作用是将他们的数据传送给被调用过程对应的形参变量;
③值引用:即值传递,按传值方式传递参数,系统将实参的值传递给对应的形参后,实参于形参断开了联系,即使在过程体中改变形参的值,也不会影响到实参; ④地址引用:按传地址方式传递参数,要求参数必须是变量名,此时的实参于形参变量公用一个存储单元,如果在过程中改变了形参的值,对应的实参也将发生改变;
⑤地址引用时要求对应的实参必须是变量名。
9.怎样用Point方法比较两张图片?
答:Point方法用于返回在Form窗体或PictureBox控件上所指定值的红
绿蓝(RGB)颜色。语法:object.Point(x, y)object:可选的参数。一个对象表达式。如果省略object,则为带有焦点的Form窗体。x, y:必要的参数。均为单精度值,指示Form或PictureBox的ScaleMode属性中该点的水平(x轴)和垂直(y轴)坐标。必须用括号括上这些值。利用Point方法逐点比较两张图片,如果每个点的值都相同,则这两张图片相同,否则不相同。
10.如果要显示数据表中的照片,可使用那些控件?
答:如果要显示数据表中的照片,可使用图形框控件或图像框控件绑定到
存放图形数据的字段显示出图形。
二、应用程序设计题
1.设计适当的界面,利用If语句、Select Case语句两种方法计算分段函数: ??? y?????x?3x?23x?21?xx2x?2010?x?200?x?10
设计步骤:
(1) 设计程序界面及控件属性。在窗体中添加两个文本框Text1、Text2
和一个Command1按钮,(2)在代码窗口输入如下代码
利用if语句计算的代码如下: Private Sub Command1_Click() Dim x#, y#
x = Text1.Text If x > 20 Then
y = x * x + 3 * x + 2 End If
If 10 <= x <= 20 Then
y = Sqr(3 * x) - 2 End If
If 0 <= x < 10 Then
y = 1 / x + Abs(x) End If
Text2.Text = y End Sub
利用Select语句的代码如下: Private Sub Command1_Click() Dim x#, y#
x = Text1.Text Select Case x Case 20 To 255
y = x * x + 3 * x + 2 Case 10 To 20
y = Sqr(3 * x) - 2 Case 0 To 10
y = 1 / x + Abs(x) End Select Text2.Text = y End Sub
2.利用随机函数产生20个50~100之间的随机数,显示其中的最大值,最小值和平均值。
设计步骤:
(1)设计程序界面及控件属性。在窗体中添加一个Command1按钮,将Command1的Caption属性设为确定(2)在代码窗口输入如下代码: Private Sub Command1_Click() Cls
Dim i As Integer, x!, max!, min!, ave! max = 50 min = 100 ave = 0
For i = 1 To 20
x = 50 + 50 * Rnd Print x
If x > max Then max = x End If
If x < min Then min = x End If
ave = ave + x Next i
ave = ave / 20
Print \最大值=\Print \最小值=\Print \平均值=\End Sub
3.自定义一个职工类型,包括职工号、姓名、工资。声明一个职工类型的动态数组,输入n个职工的数据。要求按工资递减的顺序排序,并显示排序的结果,每个职工一行显示三项信息。
设计步骤:
(1) 设计程序界面及控件属性。在窗体中添加一个Command1按钮,将Command1
的Caption属性设为确定(2)在代码窗口输入如下代码: '******************* 'release time:28/6/2010 'purpose:自定义数据类型 'programmer:troy '**************** Option Explicit
Private Sub Command1_Click() Me.Cls
Dim workList() As WorkType, workTemp As WorkType Dim i As Integer, j As Integer, n As Integer
n = CInt(Val(InputBox(\请输入需要记录的总人数\& Chr(10) & Chr(13) & \确定人数-troy\ If n = 0 Then
MsgBox \ Exit Sub End If
If n = 1 Then GoTo label End If
ReDim workList(1 To n) For i = 1 To n
workList(i).intNo = CInt(Val(InputBox(\第\位员工职工号输入\信息输入-troy\
workList(i).sngWage = Val(InputBox(\第\位员工工资输入\Chr(10) & Chr(13) & \信息输入-troy\
workList(i).strName = CStr(InputBox(\第\位员工名字输入\Chr(10) & Chr(13) & \信息输入-troy\ Next
For i = 1 To n - 1
For j = i + 1 To n
If workList(j).sngWage > workList(i).sngWage Then workTemp = workList(i) workList(i) = workList(j) workList(j) = workTemp End If Next Next
Print \名次\职工号\工资\名字\ For i = 1 To n Print i, workList(i).intNo, workList(i).sngWage, workList(i).strName Next
Exit Sub label:
workTemp.intNo = CInt(Val(InputBox(\第1位员工职工号输入\信息输入\
workTemp.sngWage = Val(InputBox(\第1位员工工资输入\\信息输入\ workTemp.strName = CStr(InputBox(\第1位员工名字输入\信息输入\
Print \名次\职工号\工资\名字\
Print 1, workTemp.intNo, workTemp.sngWage, workTemp.strName End Sub
4.利用迭代法求方程x2?a?0的近似根,要求精度为10?5,迭代公式为:
xi?1?12(xi?axi)。编制三个过程:迭代函数过程、迭代子过程和递归法函数过程。
答:(1)设计程序界面及控件属性:
添加3个标签,3个文本框,3个命令按钮, Lable1、2、3的Caption属性设为a=,x1=,x=,Txet1、2、3的text属性均设为空。Command1、2、3的Caption属性设为迭代子过程、迭代子函数、递归
(2)在代码窗口输入如下代码:
Option Explicit
Private Sub Command1_Click()
Dim a As Single, x1 As Single, x2 As Single a = Val(Text1) x1 = Val(Text2)
Call SubFunc(a, x1, x2) Text4 = x2 End Sub
Private Sub SubFunc(a As Single, x1 As Single, x2 As Single) Dim temp As Single temp = x1
Do While Abs(x2 - temp) > 0.00001 x2 = (x1 + a / x1) / 2 temp = x1 x1 = x2 Loop End Sub
Private Sub Command2_Click()
Dim a As Single, x1 As Single, x2 As Single a = Val(Text1) x1 = Val(Text2)
Text4 = Func(a, x1, x2) End Sub
Private Function Func(a As Single, x1 As Single, x2 As Single) As Single
Dim temp As Single temp = x1
Do While Abs(x2 - temp) > 0.00001 x2 = (x1 + a / x1) / 2 temp = x1 x1 = x2 Loop
Func = x2 End Function
Private Function Recursion(a As Single, x1 As Single, x2 As Single) As Single
If Abs(x2 - x1) <= 0.00001 Then Recursion = x2 Else
Recursion = Recursion(a, x2, (x1 + a / x1) / 2) End If
End Function
Private Sub Command3_Click()
Dim a As Single, x1 As Single, x2 As Single a = Val(Text1) x1 = Val(Text2)
Text4 = Recursion(a, x1, x2) End Sub
Private Sub Form_Load() Text1.TabIndex = 0 End Sub
5.在数据文件score.dat中存储有若干学生某门课的成绩(用写字板或记事本自己建立该文件,数据之间用空格分隔或每行一个数据)。设计程序从文件中读数据,显示在窗体上,并求标准差。 S?(X?X)?n?1ii?11n2 其中:n是数据的个数,X是n个数据的平均值。
设计步骤:
(1) 设计程序界面及控件属性。在窗体中添加一个Command1按钮,将Command1
的Caption属性设为读取文件(2)在代码窗口输入如下代码:
'******************* 'release time:28/5/2010
'purpose:文件读取,并求标准差 'programmer:troy '****************
Option Explicit
Dim maxLine As Integer
Private Sub Command1_Click() Dim myChar As String Dim myStr As String Dim myTemp() As String
Dim myArray() As Integer, i As Integer Dim result As Single, leng As Integer
Open App.Path & \ Do While Not EOF(1)
myChar = Input(1, #1) myStr = myStr & myChar Loop Close #1 Print myStr
myTemp = Split(myStr, vbLf) leng = UBound(myTemp)
ReDim myArray(UBound(myTemp)) For i = 0 To UBound(myTemp) - 1
myArray(i) = CInt(Val(myTemp(i))) Next
result = Func(myArray(), leng) Print \End Sub
Private Sub Form_Load() Dim myChar As String
Open App.Path & \ Do While Not EOF(1)
myChar = Input(1, #1) If myChar = vbLf Then
maxLine = maxLine + 1 End If Loop Close #1
maxLine = maxLine + 1
Label1.Caption = \共有\行\End Sub
Private Function Func(a() As Integer, length As Integer) As Single Dim sum As Long, average As Single, sumA As Single Dim i As Integer
For i = 0 To length - 1 sum = sum + a(i) Next
average = CSng(sum) / length For i = 0 To (length - 1)
sumA = sumA + (a(i) - average) ^ 2 Next
Func = Sqr(sumA / (length - 1)) End Function
6.单击窗体时,用Line方法在窗体上随机产生20条长度、颜色、宽度各异的直线(左图)。双击窗体时,用Pset方法在窗体上画200个随机彩色点,点的大小在3~6个之间变化(右图)。
(1)单击窗体时产生20条随机直线,代码如下: Private Sub Form_Load()
Me.Scale (-100, 100)-(100, -100) End Sub
Private Sub Form_Click() Cls
Dim x1 As Single, y1 As Single Dim x2 As Single, y2 As Single
Dim i% Randomize
For i = 1 To 20
DrawWidth = 1 + 10 * Rnd x1 = (-100) * Rnd y1 = 200 * Rnd - 100 x2 = 100 * Rnd
y2 = 200 * Rnd - 100
Form1.Line (x1, y1)-(x2, y2), RGB(255 * Rnd, 255 * Rnd, 255 * Rnd) Next i End Sub
(2)双击窗体时产生200个随机点,代码如下: Private Sub Form1_DblClick() Cls
Dim i%,x!,y! Randomize
For i = 1 To 200
DrawWidth = 3 + 30 * Rnd x = Form1.ScaleWidth * Rnd y = Form1.ScaleHeight * Rnd
Form1.Pset(x,y), RGB(255 * Rnd,255 * Rnd,255 * Rnd) Next i End Sub
7. 设计一个类似于Windows附件中的计算器,完成以下要求:①运行程序并分析代码,找出存在的问题并设法修改;②将其扩充成为Windows附件中的标准型计算器。
〖设计步骤〗
⑴设计程序界面及控件属性。如图所示,在窗体中添加一个文本框,将其Text属性设置为空,Enabled属性设置为False。添加包含11个按扭的命令按扭数组Command1(0)~Command1(10),将它们的Caption属性分别改为“1”、“2”…“9”、“0”和“.”。添加一个Caption属性为“=”的按扭Command2。添加包含2个按扭的命令按扭数组Command3(0)~Command3(1),将它们的Caption属性分别改为“+”和“-”。 添加一个Caption属性分别改为“清除”的按扭Command4。
⑵在代码窗口输入如下代码
Option Explicit
Dim a As Single, b As Single, c As Integer Private Sub Command1_Click(Index As Integer) Text1.Text = Text1.Text + Command1(Index).Caption End Sub
Private Sub Command2_Click() b = Text1.Text Select Case index Case 0
a = a + b Case 1
a = a - b End Select
Text1.Text = a End Sub
标准计算器:
答:(1)在原有的基础上,添加命令按扭如图所示:
2)程序代码如下: Dim n, c, m As Single Dim a As String
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text & Index '0到9的控件数组
End Sub
Private Sub Command2_Click()
If Text1.Text = \小数点 Text1.Text = \ Else
Text1.Text = Text1.Text & \ End If End Sub
Private Sub Command3_Click() n = Val(Text1.Text) Select Case a Case \ c = m / n Case \ c = m * n Case \ c = m + n Case \
c = m - n ' End Select
Text1.Text = c
If Abs(c) < 1 Then If c < 0 Then
Text1.Text = -Text1.Text
Text1.Text = \
Else: If c > 0 Then Text1.Text = \ End If End If End Sub
Private Sub Command4_Click()
s = Len(Text1.Text) 'backspace Text1.Text = Left(Text1.Text, s - 1) End Sub
Private Sub Command5_Click() Text1.Text = \End Sub
Private Sub Command6_Click() m = Val(Text1.Text)
a = \Text1.Text = \End Sub
Private Sub Command7_Click() m = Val(Text1.Text)
a = \Text1.Text = \End Sub
Private Sub Command8_Click()
等号 加号 减号 m = Val(Text1.Text)
a = \乘号 Text1.Text = \End Sub
Private Sub Command9_Click() m = Val(Text1.Text) a = \
Text1.Text = \除号 End Sub
Private Sub Command10_Click()
Label1.Caption = \End Sub
Private Sub Command11_Click()
Text1.Text = Label1.Caption 'MR End Sub
Private Sub Command12_Click()
Label1.Caption = Text1.Text 'MS End Sub
Private Sub Command13_Click()
Label1.Caption = Val(Label1.Caption) + Val(Text1.Text) 'M+ End Sub
Private Sub Command14_Click()
Text1.Text = Sqr(Text1.Text) '开方 End Sub
Private Sub Command15_Click()
Text1.Text = Text1.Text ^ 2 '平方 End Sub
Private Sub Command16_Click()
Text1.Text = 1 / Val(Text1.Text) '1/x If Abs(Text1.Text) < 1 Then If Text1.Text < 0 Then Text1.Text = -Text1.Text
Text1.Text = \
Else: If Text1.Text > 0 Then Text1.Text = \ End If End If End Sub
Private Sub Command17_Click()
Text1.Text = Val(Text1.Text) * 0.01 '百分号 If Abs(Text1.Text) < 1 Then
If Text1.Text < 0 Then Text1.Text = -Text1.Text
Text1.Text = \
2
Else: If Text1.Text > 0 Then Text1.Text = \ End If End If End Sub
8. 设计学生信息管理系统(参照第十章例题,界面自己规划设计)
主要的数据表: 学生基本情况表,学生成绩表,课程表等,表结构自己确定。 主要功能模块:
实现学生基本情况的录入、修改、删除等基本操作。 对学生基本信息提供灵活的查询方式。 完成一个班级的学期选课功能。
实现学生成绩的录入、修改、删除等基本操作。 能方便的对学生各个学期成绩进行查询。 具有成绩统计、排名等功能。
解答:
设计过程如下: Form1:
程序代码:
Dim i, j, n As Integer Dim sql As String
Private Declare Function GetKeyState Lib \ (ByVal nVirtKey As Long) As Integer
Public je As Integer '记忆菜单上次数值,实现数据传送 Private Sub acg_Click() Call asPopup7_Click(False) End Sub
Private Sub addcg_Click()
Call asPopup6_Click(False) End Sub
Private Sub addstudent_Click() Call asPopup2_Click(False) End Sub
Private Sub asPopup1_Click(Cancel As Boolean) Grid1.Visible = True Grid2.Visible = False tkbase = \学生信息\fnumber = 13
sql = \学号 desc\grid1pz '执行grid1的分配空间任务 datagrid '按要求读取数据空间 End Sub
Private Sub grid1pz() '处理grid1的操作 Grid1.Cols = fnumber + 1 Grid1.Column(1).Width = 120 Grid1.Column(2).Width = 100 Grid1.Column(3).Width = 80 Grid1.Column(4).Width = 40 Grid1.Column(5).Width = 80 Grid1.Column(6).Width = 30 Grid1.Column(7).Width = 50 Grid1.Column(8).Width = 80 Grid1.Column(9).Width = 60 Grid1.Column(10).Width = 80 Grid1.Column(11).Width = 100 Grid1.Column(12).Width = 100 Grid1.Column(13).Width = 100
Grid1.Column(4).CellType = cellComboBox Grid1.ComboBox(4).Clear
Grid1.ComboBox(4).AddItem \男\Grid1.ComboBox(4).AddItem \女\
Grid1.Column(5).CellType = cellCalendar Grid1.Column(2).CellType = cellComboBox Grid1.ComboBox(2).Clear
Set qy2 = cnn.Execute(\班级名称 from 班级\Do While Not qy2.EOF
Grid1.ComboBox(2).AddItem qy2.Fields(0) qy2.MoveNext Loop
Grid1.Column(9).CellType = cellComboBox Grid1.ComboBox(9).Clear
Grid1.ComboBox(9).AddItem \团员\
Grid1.ComboBox(9).AddItem \党员\Grid1.ComboBox(9).AddItem \无\Grid1.Column(1).Locked = True End Sub
Private Sub asPopup10_Click(Cancel As Boolean) Dim fo2 As CTranslucentForm Set fo2 = New CTranslucentForm fo2.hWnd = Form6.hWnd
fo2.Alpha = 90 / 100 * 255 Me.WindowState = vbMinimized Load Form6 Form6.Show 1 End Sub
Private Sub asPopup2_Click(Cancel As Boolean) Grid1.Visible = True Grid2.Visible = False tkbase = \学生信息\fnumber = 13
Set qy1 = cnn.Execute(\grid1pz
For i = 1 To fnumber
Grid1.Cell(0, i).Text = qy1.Fields(i - 1).Name Next
Grid1.Column(1).Locked = False Grid1.Rows = 1 Grid1.Rows = 21
gridsave = True '允许保存 griddelete = False '拒绝删除 gridedit = False End Sub
Private Sub asPopup3_Click(Cancel As Boolean) Dim fo2 As CTranslucentForm Set fo2 = New CTranslucentForm fo2.hWnd = Form2.hWnd
fo2.Alpha = 90 / 100 * 255 Me.WindowState = vbMinimized Load Form2 Form2.Show 1 End Sub
Private Sub asPopup4_Click(Cancel As Boolean) Dim fo2 As CTranslucentForm Set fo2 = New CTranslucentForm fo2.hWnd = Form4.hWnd
fo2.Alpha = 90 / 100 * 255 Me.WindowState = vbMinimized Load Form4 Form4.Show 1 End Sub
Private Sub asPopup5_Click(Cancel As Boolean) Frame2.Visible = True End Sub
Private Sub asPopup6_Click(Cancel As Boolean) Grid1.Visible = False Grid2.Visible = True tkbase = \学生与课程\fnumber = 6 gridpz2
Set qy1 = cnn.Execute(\For i = 1 To fnumber
Grid2.Cell(0, i).Text = qy1.Fields(i - 1).Name Next
Grid2.Rows = 1 Grid2.Rows = 21 gridsave = True gridedit = False griddel = False
Grid2.Column(1).Locked = False Grid2.Column(2).Locked = True Grid2.Column(3).Locked = False Grid2.Column(4).Locked = True End Sub
Private Sub asPopup7_Click(Cancel As Boolean) Grid1.Visible = False Grid2.Visible = True tkbase = \学生与课程\fnumber = 6
sql = \学号 asc\gridpz2 datagrid
gridsave = False gridedit = True griddel = True
Grid2.Column(1).Locked = True Grid2.Column(2).Locked = True Grid2.Column(3).Locked = True Grid2.Column(4).Locked = True End Sub
Private Sub gridpz2() Grid2.Cols = 8
Grid2.Column(1).Width = 120 Grid2.Column(3).Width = 120
Grid2.Column(1).CellType = cellComboBox
Set qy1 = cnn.Execute(\课程\Grid2.ComboBox(1).Clear Do While Not qy1.EOF
Grid2.ComboBox(1).AddItem qy1.Fields(0) & \qy1.MoveNext Loop
Grid2.Column(3).CellType = cellComboBox
Set qy1 = cnn.Execute(\学号,名字 from 学生信息\Grid2.ComboBox(3).Clear Do While Not qy1.EOF
Grid2.ComboBox(3).AddItem qy1.Fields(0) & \qy1.MoveNext Loop End Sub
Private Sub asPopup8_Click(Cancel As Boolean) Dim fo2 As CTranslucentForm Set fo2 = New CTranslucentForm fo2.hWnd = Form7.hWnd
fo2.Alpha = 85 / 100 * 255 Load Form7 Form7.Show 1 End Sub
Private Sub asPopup9_Click(Cancel As Boolean) End
End Sub
Private Sub c1_Click(Index As Integer) '提交内容到函数执行,4为当前菜单(0-4),index是按钮数组名称 cmove 4, Index End Sub
Private Sub cmove(s As Integer, i As Integer) '菜单智能移动函数代码S代表菜单的总数,i代表当前移动的是数组名称 Dim j As Integer
Dim x, y, z, x1, y1 As Integer
x = s '将x,y,z,x1赋于菜单总数,x存放frame1的固定值 y = s 'y存放的是移动后的按钮的固定值 z = s 'Z没用上 x1 = s 'X1没用上
j = 0 'j计算按钮的宽度
Do While s > 0 ' 这里是通过重复计算来计算按钮所需移动的总高度
ac4 = ac4 + 1 Case 0 To 59 ac5 = ac5 + 1 End Select qy2.MoveNext Loop
Grid1.Cols = Grid1.Cols + 5
Grid1.Cell(17, 1).Text = \比例统计\ Grid1.Cell(18, 1).Text = \优\ Grid1.Cell(18, 2).Text = \良\ Grid1.Cell(18, 3).Text = \中\ Grid1.Cell(18, 4).Text = \及格\ Grid1.Cell(18, 5).Text = \不及格\ Grid1.Cell(19, 1).Text = ac1 Grid1.Cell(19, 2).Text = ac2 Grid1.Cell(19, 3).Text = ac3 Grid1.Cell(19, 4).Text = ac4 Grid1.Cell(19, 5).Text = ac5 '设置单元格格式
Grid1.Cell(17, 1).Font.SIZE = 11 Grid1.Range(17, 1, 17, 5).Merge
Grid1.Range(17, 1, 17, 5).Alignment = cellCenterCenter Grid1.Range(18, 1, 19, 5).Alignment = cellCenterCenter Grid1.Range(18, 1, 18, 5).BackColor = vbYellow With Grid1.Range(18, 1, 18, 5)
.Borders(cellEdgeLeft) = cellThin .Borders(cellEdgeRight) = cellThin .Borders(cellEdgeTop) = cellThin .Borders(cellEdgeBottom) = cellThin
.Borders(cellInsideHorizontal) = cellThin .Borders(cellInsideVertical) = cellThin End With
'添加一个饼图
With Grid1.Range(22, 1, 32, 5) .Merge
.Borders(cellEdgeLeft) = cellThin .Borders(cellEdgeRight) = cellThin .Borders(cellEdgeTop) = cellThin .Borders(cellEdgeBottom) = cellThin End With
Grid1.AddChart 22, 1 With Grid1.Chart(22, 1)
.SetDataSource 18, 1, 19, 5 .ChartType = cell3DPie
.DisplayDataLabels = True .ScaleFont = False End With
Grid1.PageSetup.CenterHorizontally = True '设置打印区域 Grid1.PageSetup.PrintRows = 37 Grid1.PageSetup.PrintColumns = 4 Grid1.AutoRedraw = True Grid1.Refresh Exit Sub finish:
MsgBox Err.Description
'MsgBox \无此对象或其它参数错误!\End Sub
Private Sub Form_Resize() If Me.WindowState <> 1 Then Grid1.Left = 240
Grid1.Width = Me.Width - 480 Grid1.Top = 240
Grid1.Height = Me.Height - 960 End If End Sub Form6:
Private Declare Function GetKeyState Lib \ (ByVal nVirtKey As Long) As Integer Private Sub Form_Load()
Grid1.SetRegisterInformation \进行注册 With Grid1
.AllowUserResizing = True .DisplayFocusRect = False .ExtendLastCol = True .Appearance = Flat
.FixedRowColStyle = Flat .ScrollBarStyle = Flat
.DefaultFont.Name = \ .DefaultFont.SIZE = 8
.BackColorFixed = RGB(90, 158, 214)
.BackColorFixedSel = RGB(110, 180, 230) .BackColorBkg = RGB(90, 158, 214)
.BackColorScrollBar = RGB(231, 235, 247) .BackColor1 = RGB(231, 235, 247) .BackColor2 = RGB(239, 243, 255)
\ .GridColor = RGB(148, 190, 231) .Column(0).Width = 0 .Column(1).Width = 100 .Column(2).Width = 100 .Column(3).Width = 100 End With
Call callmain End Sub
Private Sub callmain() gridsave = False gridedit = True griddelete = True
Set qy1 = cnn.Execute(\班级\Grid1.Rows = 1 '清除所有记录 i = 3
Grid1.Cols = i + 1 '必须+2,因为实际上为11行,但第一行是隐藏的 For i = 0 To 2 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = qy1.Fields(i).Name '读取表中的各字段名 Next i = 1
Do While Not qy1.EOF
Grid1.Rows = Grid1.Rows + 1 For j = 1 To 3 '设定读取列
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid1.Cell(i, j).Text = \ Else
Grid1.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
i = i + 1
qy1.MoveNext '读取下一记录 Loop
Grid1.Column(1).Locked = True End Sub
Private Sub Form_Unload(Cancel As Integer) Call XPButton5_Click End Sub
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 2 Then PopupMenu cz
End If End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long) hang = Row End Sub
Private Sub Grid1_Validate(Cancel As Boolean) '设定TAB键切换 Dim nActiveRow As Long, nActiveCol As Long Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row nActiveCol = Grid1.ActiveCell.Col If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected End If
Cancel = True End If End Sub
Private Sub renovate_Click() Call callmain End Sub
Private Sub XPButton1_Click() gridsave = True gridedit = False griddelete = False
Set qy1 = cnn.Execute(\班级\Grid1.Rows = 1 '清除所有记录 Grid1.Rows = 2 '默认为2行 i = 3
Grid1.Cols = i + 1 '必须+2,因为实际上为11行,但第一行是隐藏的 For i = 0 To 2 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = qy1.Fields(i).Name '读取表中的各字段名 Next
Grid1.Column(1).Locked = False Grid1.Cell(1, 1).SetFocus End Sub
Private Sub XPButton2_Click() If gridsave = False Then
MsgBox \不支持保存操作!\当前不支持\Exit Sub End If
If Grid1.Cell(1, 1).Text <> \
Set qy1 = cnn.Execute(\* from 班级 where 班级名称='\& Grid1.Cell(1, 1).Text & \ If qy1.EOF = True Then
Set qy1 = cnn.Execute(\into 班级 values('\& Grid1.Cell(1, 1).Text & \& Grid1.Cell(1, 2).Text & \& Grid1.Cell(1, 3).Text & \
MsgBox \提交成功!\ Call callmain Else
MsgBox \该班级名己存在!\不可重名\ Exit Sub End If Else
MsgBox \用户名不可以是空格\错误提示\End If End Sub
Private Sub XPButton3_Click() If gridedit = False Then
MsgBox \当前修改操作不被允许!\非使用对象\Exit Sub End If
For i = 1 To Grid1.Rows - 1
Set qy1 = cnn.Execute(\班级 set 班级辅导员='\Grid1.Cell(i, 2).Text & \所属系别='\where 班级名称='\ Next
MsgBox \修改的数据己经完成\完成操作\ Call callmain End Sub
Private Sub XPButton4_Click() If griddelete = False Then
MsgBox \当前删除操作不被允许!\非使用对象\Exit Sub End If
If hang = 0 Then Exit Sub End If
If Grid1.Cell(hang, 1).Text = \Exit Sub End If
Set qy1 = cnn.Execute(\from 班级 where 班级名称='\& Grid1.Cell(hang, 1).Text & \
If je > i Then Do While x > i Do While y >= x
j = j + 360 '360是每个按钮的高度 y = y - 1 Loop
c1(x).Top = Fre1.Height - j x = x - 1 Loop Else
'-----------------向上代码 For x = 0 To i For y = 0 To x j = j + 360 Next
c1(x).Top = j - 360 j = 0 Next End If s = s - 1
For y1 = 0 To x1 If y1 = i Then
Fre2(y1).Visible = True
Fre2(y1).Top = c1(y1).Top + c1(y1).Height If y1 <> z Then
Fre2(y1).Height = c1(y1 + 1).Top - Fre2(y1).Top Else
Fre2(y1).Height = Fre1.Height - c1(y1).Top - c1(y1).Height End If Else
Fre2(y1).Visible = False End If Next Loop
je = i '这里是记忆上次移动的按钮数组编号 End Sub
Private Sub cgdel_Click() Call XPButton6_Click End Sub
Private Sub cgedit_Click() Call XPButton4_Click End Sub
Private Sub delstudent_Click() Call XPButton6_Click
End Sub
Private Sub editstudent_Click() Call XPButton4_Click End Sub
Private Sub findcg_Click() If hang = 0 Then Exit Sub End If
Grid1.Visible = False Grid2.Visible = True tkbase = \学生与课程\fnumber = 5
sql = \学生与课程 where 学号='\1).Text & \gridpz2 datagrid
gridsave = False gridedit = True griddel = True
Grid2.Column(1).Locked = True Grid2.Column(2).Locked = True Grid2.Column(3).Locked = True End Sub
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 2 Then
If gridsave = True Then
savestudent.Enabled = True Else
savestudent.Enabled = False End If
If gridedit = True Then
editstudent.Enabled = True Else
editstudent.Enabled = False End If
If griddel = True Then
delstudent.Enabled = True Else
delstudent.Enabled = False End If
If admin = False Then
addstudent.Enabled = False savestudent.Enabled = False
editstudent.Enabled = False delstudent.Enabled = False End If
PopupMenu student End If End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long) hang = Row
If gridsave = True And Col = 5 Then '确认默认年龄在20岁左右 If Row <> 0 Then
Grid1.Cell(Row, 5).Text = Date - 7300 End If End If End Sub
Private Sub Grid1_Validate(Cancel As Boolean) '设定TAB键切换 Dim nActiveRow As Long, nActiveCol As Long Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row nActiveCol = Grid1.ActiveCell.Col If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected End If
Cancel = True End If End Sub
Private Sub Form_Load() On Error GoTo finish
Grid1.SetRegisterInformation \\进行注册 Grid2.SetRegisterInformation \\进行注册
Label2.Caption = \今天是\年\月\Day(Date) & \日,欢迎您进入!\Frame2.Visible = False
form1.BackColor = RGB(167, 111, 177) '-------------管理员验证 If admin = False Then c1(3).Enabled = False
asPopup2.Enabled = False '增加学生 asPopup4.Enabled = False '课程管理 asPopup6.Enabled = False '输入成绩 XPButton4.Enabled = False
XPButton5.Enabled = False XPButton6.Enabled = False End If
With Grid1
.AllowUserResizing = True .DisplayFocusRect = False .ExtendLastCol = True .Appearance = Flat
.FixedRowColStyle = Flat .ScrollBarStyle = Flat
.DefaultFont.Name = \ .DefaultFont.SIZE = 8
.BackColorFixed = RGB(84, 201, 134)
.BackColorFixedSel = RGB(167, 111, 177) .BackColorBkg = RGB(198, 229, 211)
.BackColorScrollBar = RGB(167, 111, 177) .BackColor1 = RGB(231, 235, 247) .BackColor2 = RGB(198, 229, 211) .GridColor = RGB(148, 190, 231) .Column(0).Width = 0 End With With Grid2
.AllowUserResizing = True .DisplayFocusRect = False .ExtendLastCol = True .Appearance = Flat
.FixedRowColStyle = Flat .ScrollBarStyle = Flat .AllowUserResizing = True .DisplayFocusRect = False .ExtendLastCol = True .Appearance = Flat
.FixedRowColStyle = Flat .ScrollBarStyle = Flat
.DefaultFont.Name = \ .DefaultFont.SIZE = 8
.BackColorFixed = RGB(84, 201, 134)
.BackColorFixedSel = RGB(167, 111, 177) .BackColorBkg = RGB(198, 229, 211)
.BackColorScrollBar = RGB(167, 111, 177) .BackColor1 = RGB(231, 235, 247) .BackColor2 = RGB(198, 229, 211) .GridColor = RGB(148, 190, 231) .Column(0).Width = 0
End With je = 4
Dim fr As Integer
Fre1.BackColor = RGB(168, 217, 189) For fr = 0 To 4
Fre2(fr).Visible = False
Fre2(fr).BackColor = RGB(106, 137, 188) Next
Grid2.Visible = False Call c1_Click(0) Exit Sub finish:
MsgBox Err.Description End Sub
Private Sub Grid2_CellChange(ByVal Row As Long, ByVal Col As Long) '使用智能输入
If Grid2.Cell(Row, 1).Text <> \ Dim length1, length2 As Integer
length1 = Len(Grid2.Cell(Row, 1).Text) Do While length2 < length1 length2 = length2 + 1
If Right(Left(Grid2.Cell(Row, 1).Text, length2), 1) = \ Grid2.Cell(Row, 2).Text = Mid(Grid2.Cell(Row, 1).Text, length2 + 1, length1)
Grid2.Cell(Row, 1).Text = Mid(Grid2.Cell(Row, 1).Text, 1, length2 - 1) Exit Do End If Loop End If
If Grid2.Cell(Row, 3).Text <> \ Dim length3, length4 As Integer
length3 = Len(Grid2.Cell(Row, 3).Text) Do While length4 < length3 length4 = length4 + 1
If Right(Left(Grid2.Cell(Row, 3).Text, length4), 1) = \ Grid2.Cell(Row, 4).Text = Mid(Grid2.Cell(Row, 3).Text, length4 + 1, length4)
Grid2.Cell(Row, 3).Text = Mid(Grid2.Cell(Row, 3).Text, 1, length4 - 1) Exit Do End If Loop
End If End Sub
Private Sub Grid2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 2 Then
If admin = False Then cgedit.Enabled = False cgdel.Enabled = False addcg.Enabled = False End If
PopupMenu cg End If End Sub
Private Sub Grid2_RowColChange(ByVal Row As Long, ByVal Col As Long) hang = Row End Sub
Private Sub datagrid()
griddelete = True '允许删除 gridedit = True
If tkbase = \学生信息\
If qy1.State = adStateOpen Then '表状态 qy1.Close End If
qy1.Open sql, cnn, adOpenStatic, adLockReadOnly, adCmdText For i = 1 To fnumber
Grid1.Cell(0, i).Text = qy1.Fields(i - 1).Name Next
qy1.PageSize = 20 nnum = qy1.PageCount
If qy1.PageCount = 0 Then nnum = 1 End If
numpage = 1
Label1.Caption = \共\页 第\页\Grid1.Rows = 1 Grid1.Rows = 21
If qy1.RecordCount = 0 Then Exit Sub End If
qy1.AbsolutePage = numpage
For i = 1 To qy1.PageSize '设定读取行 For j = 1 To fnumber '设定读取列 If qy1.EOF = True Then Exit Sub
End If
If Not qy1.Fields(j - 1) Is Nothing Then '空值的处理 Grid1.Cell(i, j).Text = qy1.Fields(j - 1) Else
Grid1.Cell(i, j).Text = \ End If Next
If qy1.EOF = False Then qy1.MoveNext '读取下一记录 Else
Exit Sub End If Next
ElseIf tkbase = \学生与课程\
If qy1.State = adStateOpen Then '表状态 qy1.Close End If
qy1.Open sql, cnn, adOpenStatic, adLockReadOnly, adCmdText For i = 1 To fnumber
Grid2.Cell(0, i).Text = qy1.Fields(i - 1).Name Next
qy1.PageSize = 20 nnum = qy1.PageCount
If qy1.PageCount = 0 Then nnum = 1 End If
numpage = 1
Label1.Caption = \共\页 第\页\Grid2.Rows = 1 Grid2.Rows = 21
If qy1.RecordCount = 0 Then Exit Sub End If
qy1.AbsolutePage = numpage
For i = 1 To qy1.PageSize '设定读取行 For j = 1 To fnumber '设定读取列 If qy1.EOF = True Then Exit Sub End If
If Not qy1.Fields(j - 1) Is Nothing Then '空值的处理 Grid2.Cell(i, j).Text = qy1.Fields(j - 1) Else
Grid2.Cell(i, j).Text = \ End If
Next
If qy1.EOF = False Then qy1.MoveNext '读取下一记录 Else
Exit Sub End If Next End If End Sub
Private Sub Grid2_Validate(Cancel As Boolean) Dim nActiveRow As Long, nActiveCol As Long Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row nActiveCol = Grid1.ActiveCell.Col If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected End If
Cancel = True End If End Sub
Private Sub Label7_Click() If tkbase = \学生信息\If numpage > 1 Then numpage = numpage - 1
qy1.AbsolutePage = numpage Grid1.Rows = 1 Grid1.Rows = 21
For i = 1 To 20 '设定读取行
For j = 1 To fnumber '设定读取列
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid1.Cell(i, j).Text = \ Else
Grid1.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
qy1.MoveNext '读取上一记录 Next End If
Label1.Caption = \共\页 第\页\ElseIf tkbase = \学生与课程\If numpage > 1 Then numpage = numpage - 1
qy1.AbsolutePage = numpage Grid2.Rows = 1 Grid2.Rows = 21
For i = 1 To 20 '设定读取行
For j = 1 To fnumber '设定读取列
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid2.Cell(i, j).Text = \ Else
Grid2.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
qy1.MoveNext '读取上一记录 Next End If
Label1.Caption = \共\页 第\页\End If End Sub
Private Sub Label8_Click() If tkbase = \学生信息\If numpage < nnum Then numpage = numpage + 1
qy1.AbsolutePage = numpage Grid1.Rows = 1 Grid1.Rows = 21
For i = 1 To 20 '设定读取行
For j = 1 To fnumber '设定读取列 If qy1.EOF = True Then
Label1.Caption = \共\页 第\页\ Exit Sub End If
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid1.Cell(i, j).Text = \ Else
Grid1.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
If qy1.EOF = False Then
qy1.MoveNext '读取下一记录 Else
Label1.Caption = \共\页 第\页\ Exit Sub End If Next
End If
Label1.Caption = \共\页 第\页\ElseIf tkbase = \学生与课程\If numpage < nnum Then numpage = numpage + 1
qy1.AbsolutePage = numpage Grid2.Rows = 1 Grid2.Rows = 21
For i = 1 To 20 '设定读取行
For j = 1 To fnumber '设定读取列 If qy1.EOF = True Then
Label1.Caption = \共\页 第\页\ Exit Sub End If
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid2.Cell(i, j).Text = \ Else
Grid2.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
If qy1.EOF = False Then
qy1.MoveNext '读取下一记录 Else
Label1.Caption = \共\页 第\页\ Exit Sub End If Next End If
Label1.Caption = \共\页 第\页\End If End Sub
Private Sub pcg_Click() If hang <> 0 Then
If Grid2.Cell(hang, 2).Text <> \
sql = \sum(成绩)/count(成绩) from 学生与课程 where 学号='\& Grid2.Cell(hang, 3).Text & \ Set qy2 = cnn.Execute(sql)
MsgBox \学号为\& Grid2.Cell(hang, 3).Text & \的成绩平均为\& qy2.Fields(0) & \分\End If End If End Sub
Private Sub renovate_Click() Call asPopup1_Click(False)
End Sub
Private Sub callmain() gridsave = False gridedit = True griddelete = True
Set qy1 = cnn.Execute(\登陆\Grid1.Rows = 1 '清除所有记录 i = 3
Grid1.Cols = i + 1 '必须+2,因为实际上为11行,但第一行是隐藏的 For i = 0 To 2 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = qy1.Fields(i).Name '读取表中的各字段名 Next i = 1
Do While Not qy1.EOF
Grid1.Rows = Grid1.Rows + 1 For j = 1 To 3 '设定读取列
If qy1.Fields(j - 1) = Null Then '空值的处理 Grid1.Cell(i, j).Text = \ Else
Grid1.Cell(i, j).Text = qy1.Fields(j - 1) End If Next
i = i + 1
qy1.MoveNext '读取下一记录 Loop
Grid1.Column(1).Locked = True End Sub
Private Sub Form_Unload(Cancel As Integer) Call XPButton5_Click End Su
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = 2 Then PopupMenu cz End If End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long) hang = Row End Sub
Private Sub Grid1_Validate(Cancel As Boolean) '设定TAB键切换 Dim nActiveRow As Long, nActiveCol As Long Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row
nActiveCol = Grid1.ActiveCell.Col If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected End If
Cancel = True End If End Sub
Private Sub renovate_Click() Call callmain End Sub
Private Sub XPButton1_Click() gridsave = True gridedit = False griddelete = False
Set qy1 = cnn.Execute(\登陆\Grid1.Rows = 1 '清除所有记录 Grid1.Rows = 2 '默认为2行 i = 3
Grid1.Cols = i + 1 '必须+2,因为实际上为11行,但第一行是隐藏的 For i = 0 To 2 '显示数据的字段名
Grid1.Cell(0, i + 1).Text = qy1.Fields(i).Name '读取表中的各字段名 Next
Grid1.Column(1).Locked = False Grid1.Cell(1, 1).SetFocus End Sub
Private Sub XPButton2_Click() If gridsave = False Then
MsgBox \不支持保存操作!\当前不支持\Exit Sub End If
If Grid1.Cell(1, 1).Text <> \
Set qy1 = cnn.Execute(\* from 登陆 where 用户名='\& Grid1.Cell(1, 1).Text & \ If qy1.EOF = True Then
Set qy1 = cnn.Execute(\into 登陆 values('\& Grid1.Cell(1, 1).Text & \& Grid1.Cell(1, 2).Text & \& Grid1.Cell(1, 3).Text & \
MsgBox \提交成功!\ Call callmain Else
MsgBox \该管理员己存在!\不可重名\ Exit Sub End If
Else
MsgBox \用户名不可以是空格\错误提示\End If End Sub
Private Sub XPButton3_Click() If gridedit = False Then
MsgBox \当前修改操作不被允许!\非使用对象\Exit Sub End If
For i = 1 To Grid1.Rows - 1
Set qy1 = cnn.Execute(\登陆 set 密码='\& Grid1.Cell(i, 2).Text & \权限='\& Grid1.Cell(i, 3).Text & \where 用户名='\ Next
MsgBox \修改的数据己经完成\完成操作\ Call callmain End Sub
Private Sub XPButton4_Click() If griddelete = False Then
MsgBox \当前删除操作不被允许!\非使用对象\Exit Sub End If
If hang = 0 Then Exit Sub End If
If Grid1.Cell(hang, 1).Text = \Exit Sub End If
Set qy1 = cnn.Execute(\from 登陆 where 用户名='\& Grid1.Cell(hang, 1).Text & \
MsgBox \目标己删除,请刷新数据!\删除成功\Call callmain End Sub
Private Sub XPButton5_Click() Unload Me
form1.WindowState = 0 End Sub Form3:
Private backFile As String Private qs As String Private buff As String Dim pnum As Integer
Private Sub Form_Load()
Text1.BackColor = RGB(98, 162, 207) Text2.BackColor = RGB(98, 162, 207) End Sub
Private Sub Command1_Click() On Error GoTo finish Set qy1 = cnn.Execute(\* from 登陆 where 用户名='\& Text1.Text & \密码='\If qy1.EOF = True Then If pnum < 2 Then pnum = pnum + 1
MsgBox \用户名或密码错误!\错误次数:\ Text1.Text = \ Text2.Text = \ Text1.SetFocus Exit Sub Else
MsgBox \用户名或密码错误超过三次,系统会自动退出\提示\ End End If Else
If qy1.Fields(2) = \超级管理员\ admin = True Else
admin = False
End If Unload Me form1.Show End If Exit Sub finish:
MsgBox Err.Description End Sub
Private Sub Command2_Click() End
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call Command1_Click End If End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call Command1_Click End If End Sub Form4:
Private Declare Function GetKeyState Lib \ (ByVal nVirtKey As Long) As Integer
Private Sub Form_Load()
Grid1.SetRegisterInformation
\进行注册 With Grid1
.AllowUserResizing = True .DisplayFocusRect = False .ExtendLastCol = True .Appearance = Flat
.FixedRowColStyle = Flat .ScrollBarStyle = Flat
.DefaultFont.Name = \ .DefaultFont.SIZE = 8
.BackColorFixed = RGB(90, 158, 214)
.BackColorFixedSel = RGB(110, 180, 230) .BackColorBkg = RGB(90, 158, 214)
.BackColorScrollBar = RGB(231, 235, 247) .BackColor1 = RGB(231, 235, 247) .BackColor2 = RGB(239, 243, 255)
\
正在阅读:
太原理工大学vb 考试试题11-12
大学生求职自荐书-求职自荐书09-07
幼儿园教育教学论文范文3000字03-08
空竹教案(第一学期)06-13
浅谈野兽派09-16
2022助理工程师年度个人工作总结04-13
效果图报价单-00709-06
卫星导航定位系统时间同步技术研究02-01
小学作文辅导教材03-12
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 太原
- 考试试题
- 理工
- 大学