〔2p=j〔3a=a〔4Command2.Enabled=True2.〔11To2*i–1〔2Command2.Enabled=True〔3Command2.Enabled=False3.〔1Text2.Enabled=False〔2p=2〔3Printi〔4Val<2或Val<=1〔5KeyAscii=134.〔1List1.ListCount〔2List1.RemoveItemI〔3i=i+15.〔1Timer1.Enabled=True〔2x\3600〔3\60或\60〔4x=x+16.〔1Label1.Left〔2Label1.Left=-Label1.Width六、程序设计题程序1.界面设计略,过程设计如下:PrivateSubCommand1_Click<>IfCommand1.Caption="显示"ThenPrint"欢迎使用VisualBasic!":Command1.Caption="清除"ElseForm1.Cls:Command1.Caption="显示"EndIfEndSubPrivateSubCommand2_Click<>EndEndSubPrivateSubForm_Load<>Form1.Cls:Command1.Caption="显示":Command2.Caption="退出"EndSub程序2.界面设计略,过程设计如下:PrivateSubForm_Load<>Text1.MaxLength=1:Text1.Text=""EndSubPrivateSubText1_KeyPressLabel1.Caption=CStrEndSub程序3.界面设计略,过程设计如下:ConstpwdAsString="123456"'预设密码为123456PrivateSubCommand1_Click<>Cls:Print"欢迎进入!"EndSubPrivateSubForm_Load<>Command1.Caption="进入":Command1.Enabled=FalsewText1.Text="":Text1.PasswordChar="*"EndSubPrivateSubText1_KeyPressIfKeyAscii=13ThenIfText1.Text=pwdThenm=MsgBox<"口令正确,欢迎进入!">:Command1.Enabled=TrueElsem=MsgBox<"口令错误,请重新输入!">:Text1.Text=""EndIfEndIfEndSub程序4.界面设计略,过程设计如下:DimnumAsInteger,mAsInteger,recAsIntegerPrivateSubForm_Load<>Command1.Caption="出题":Command1.Enabled=TrueText1.Text="":Text1.Enabled=False:rec=0EndSubPrivateSubCommand1_Click<>Randomize:num=Int+1:Text1.Enabled=TrueLabel1.Caption="":Command1.Enabled=FalseEndSubPrivateSubCommand2_Click<>EndEndSubPrivateSubText1_KeyPressIfKeyAscii=13Thenm=Val:rec=rec+1:Text1.SelStart=0Text1.SelLength=Len:Text1.SetFocusIfrec>10ThenLabel1.Caption="差!重新开始":CallForm_LoadElseIfm>numThenLabel1.Caption=Str&"大了!"ElseIfm&"小了!"ElseIfrec<5ThenLabel1.Caption="好!猜对了。"ElseLabel1.Caption="还行!猜对了。"EndIfCallForm_LoadEndIfEndIfEndIfEndSub程序5.界面设计如图10-3所示,过程设计如下:PrivateSubForm_Load<>Command1<0>.Enabled=False:Command1<1>.Enabled=FalseCommand1<2>.Enabled=False:Label1.Caption=""EndSubPrivateSubCommand1_ClickSelectCaseIndexCase0Clipboard.Clear:Clipboard.SetTextText1.SelTextText1.SelText="":Label1.Caption="请选择要粘贴的位置!"Command1<0>.Enabled=False:Command1<1>.Enabled=FalseCommand1<2>.Enabled=TrueCase1Clipboard.Clear:Clipboard.SetTextText1.SelTextLabel1.Caption="请选择要粘贴的位置!":Command1<0>.Enabled=FalseCommand1<1>.Enabled=False:Command1<2>.Enabled=TrueCaseElseText1.SelText=Clipboard.GetText<>:Form_LoadLabel1.Caption="粘贴完成!"EndSelectEndSubPrivateSubText1_MouseUpDimnAsIntegern=Text1.SelLengthIfn>0ThenLabel1.Caption="选择了"&n&"个字,请选择下一步操作!"Command1<0>.Enabled=True:Command1<1>.Enabled=TrueElseLabel1.Caption=""EndIfEndSub程序6.界面设计如图10-4所示,过程设计如下:PrivateSubForm_Load<>Label1.Caption="当前日期:":Text1.Text=DateOption1<0>.Caption="显示日期":Option1<1>.Caption="显示时间"Option1<0>.Value=True:Command1.Caption="退出"EndSubPrivateSubOption1_ClickSelectCaseIndexCase0Label1.Caption="当前日期:":Text1.Text=DateCase1Label1.Caption="当前时间:":Text1.Text=TimeEndSelectEndSubPrivateSubCommand1_Click<>EndEndSub程序7.过程设计如下:PrivateSubForm_Load<>Label1.Caption="当前日期:":Text1.Text=DateOption1<0>.Caption="显示日期":Option1<1>.Caption="显示时间"Option1<0>.Value=True:Command1.Caption="退出"Combo1.AddItem"年-月-日":Combo1.AddItem"月-日-年"Combo1.AddItem"日-月-年":Combo1.Text="年-月-日"EndSubPrivateSubCombo1_Click<>DimnAsStringSelectCaseCombo1.ListIndexCase0:n="yyyy-mm-dd"Case1:n="mm-dd-yyyy"Case2:n="dd-mm-yyyy"EndSelectText1.Text=FormatEndSubPrivateSubOption1_ClickSelectCaseIndexCase0:Label1.Caption="当前日期:":Text1.Text=DateCase1:Label1.Caption="当前时间:":Text1.Text=TimeEndSelectEndSubPrivateSubCommand1_Click<>EndEndSub程序8.界面设计如图10-5所示,过程设计如下:PrivateSubForm_Load<>List1.AddItem"happy":List1.AddItem"apple"List1.AddItem"student":List1.AddItem"computer"EndSubPrivateSubCommand1_Click<>List1.AddItemText1.Text:Text1.SetFocusText1.SelStart=0:Text1.SelLength=LenEndSubPrivateSubCommand3_Click<>List1.ClearEndSubPrivateSubCommand4_Click<>EndEndSubPrivateSubCommand2_Click<>IfList1.ListIndex<>-1ThenList1.RemoveItemList1.ListIndexEndSub9.界面设计如图10-6所示,过程设计如下:PrivateSubForm_Load<>Option1<0>.Caption="八进制":Option1<1>.Caption="十六进制"Option1<2>.Caption="二进制"EndSubPrivateFunctiontranAsStringDimxAsInteger,yAsString*1,k1AsLongtran="":k1=AbsDoWhilek1>0x=k1ModnIfx>=10Theny=Chr+x-10>Elsey=CStrtran=y+trank1=k1\nLoopIfk<0Thentran="-"+tranEndFunctionPrivateSubOption1_ClickDimkAsLong,nAsIntegerk=ValSelectCaseIndexCase0Label2.Caption="八进制":n=8Case1Label2.Caption="十六进制":n=16Case2Label2.Caption="二进制":n=2EndSelectText2.Text=tranEndSub10.界面设计如图10-7所示,过程设计如下:PrivateSubForm_Load<>Label1.Left=Width/2-Label1.Width/2Label1.AutoSize=TrueHScroll1.Min=1:HScroll1.Max=1000HScroll1.SmallChange=10:HScroll1.LargeChange=100HScroll1.Value=500:Timer1.Interval=500EndSubPrivateSubHScroll1_Change<>Timer1.Interval=HScroll1.ValueEndSubPrivateSubHScroll1_Scroll<>CallHScroll1_ChangeEndSubPrivateSubTimer1_Timer<>Label1.FontSize=Label1.FontSize+2Label1.Left=Width/2-Label1.Width/2IfLabel1.FontSize>=72ThenTimer1.Enabled=FalseEndSub第6章图形控件和图形方法一、判断题1.√2.×3.√4.×5.√6.×7.×8.×9.√10.√二、选择题1.C2.B3.C4.A5.A6.C7.A8.C9.C10.B11.A12.B13.B14.C15.C三、填空题1.Circle,8002.LoadPicture3.AutoSize、Stretch、False、False4.选中、属性5.形状、矩形6.Picture1.Picture=LodePicture<"C:\Windows\Cloud.bmp">7.图片框、其他控件8.缇、SclaeMode9.颜色10.颜色、圆弧起点处转角、圆弧终点处转角、椭圆纵轴与横轴长度之比四、程序阅读题程序1.转动一条红色直线,其轨迹形成一个圆程序2.在窗体上随机的位置、用随机的颜色、半径绘制1000个空心的圆。程序3.在图片框内绘制多个黄色边框矩形,填充样式在"实心"、"透明"间交替变换。五、程序填空题1.〔1Combo1.ListIndex〔2Shape1.BorderStyle〔3Combo2.AddItemStr2.〔1Callpic〔2False〔3n=n+1〔4LoadPicture<"c:\windows\1.bmp">〔4LoadPicture六、程序设计题程序1.界面设计略,过程设计如下:PrivateSubForm_Load<>Picture1.ScaleMode=3EndSubPrivateSubCommand1_Click<>Dimx1AsSingle,y1AsSingle,x2AsSingle,y2AsSinglex1=InputBox<"x1=">:y1=InputBox<"y1=">x2=InputBox<"x2=">:y2=InputBox<"y2=">Picture1.Line-,,BEndSub程序2.界面设计略,过程设计如下:PrivateSubForm_click<>DimrAsSingle,xoAsSingle,yoAsSingleIfForm1.ScaleHeight,r,vbYellowEndSub程序3.界面设计略,过程设计如下:PrivateSubForm_Load<>DimiAsIntegerFori=1To7:List1.AddItemi:NextiForm1.ScaleMode=1EndSubPrivateSubList1_Click<>Form1.Cls:Form1.ScaleMode=List1.TextForm1.Circle,50EndSub第7章对话框与菜单程序设计一、判断题1.√2.√3.√4.×5.×6.×7.√8.√9.√10.√二、选择题1.D2.A3.C4.C5.B6.D7.A8.B9.D10.B三、填空题1.窗体控制菜单、下拉式菜单、快捷菜单2.ShowFont3.打开文件、另存为、颜色、字体、打印对话框4.工程、部件5.CommonDialog1.Action=3、CommonDialog1.ShowColor6.提示信息、对话框类型、对话框标题7.Click8.工具9.代码窗口、Click10.相同、正四、程序阅读题程序1.显示提示信息为"5"、标题为"na的输出结果"、有一个"确定"按钮的消息框。程序2.显示提示信息为"您选择了第1项"、标题为"第一项"、有一个"确定"按钮的消息框。五、程序填空题1.〔1Int〔2Str〔3ExitFor2.〔1False〔2Date〔3CommonDialog1.Color〔4m1六、程序设计题程序1.界面设计略,过程设计如下:PrivateSubCommand1_Click<>CommonDialog1.ShowOpenList1.AddItemCommonDialog1.FileNameEndSub程序2.界面设计略,过程设计如下:PrivateSubCommand1_Click<>CommonDialog1.ShowSaveList1.AddItemCommonDialog1.FileNameEndSub程序3.界面设计如图10-9、表10-2所示,过程设计如下:PrivateSubSqr_Click<>Shape1.Shape=1EndSubPrivateSubRec_Click<>Shape1.Shape=0EndSubPrivateSubOval_Click<>Shape1.Shape=2EndSubPrivateSubCircle_Click<>Shape1.Shape=3EndSubPrivateSubRrec_Click<>Shape1.Shape=4EndSubPrivateSubRSqr_Click<>Shape1.Shape=5EndSubPrivateSubShp_Click<>Shape1.FillStyle=2EndSubPrivateSubShzh_Click<>Shape1.FillStyle=3EndSubPrivateSubXiex_Click<>Shape1.FillStyle=4EndSubPrivateSubShPJ_Click<>Shape1.FillStyle=6EndSubPrivateSubXJ_Click<>Shape1.FillStyle=7EndSubPrivateSubFillColor_Click<>CommonDialog1.ShowColorShape1.FillColor=CommonDialog1.ColorEndSubPrivateSubExit_Click<>EndEndSub第8章文件一、判断题1.×2.√3.×4.√5.√6.×7.√8.×9.√10.√11.×12.×13.√14.×15.×二、选择题1.A2.C3.B4.B5.A6.C7.C8.B9.C10.B11.D12.B13.B三、填空题1.ChDir2.FileLen3.Change4.EOF5.LineInput四、程序阅读题程序1.y=1a=1程序2.NO.13程序3.y=3a=2NO.24窗体:362516941y=6a=3NO.37文件:149162536y=10a=4NO.411程序4.程序5.1程序6.1窗体上显示内容:202212文件中内容:4681012333123444455555五、程序填空题1.〔1DimnAsInteger〔2"C:\windows\calc.exe"〔3Output〔4End2.〔1ForOutputAs#2〔20〔3"temp.dat"As"c:\a1.dat"3.〔1Open"e:\dataout.txt"ForOutputAs#1〔2t1Modt2=0〔3IfflagThen〔4Printcoun六、程序设计题程序1.界面设计如图10-10所示,过程设计如下:DimfnAsStringPrivateSubDrive1_Change<>Dir1.Path=Drive1.DriveEndSubPrivateSubDir1_Change<>File1.Path=Dir1.PathEndSubPrivateSubFile1_Click<>IfRight="\"Thenfn=File1.Path+File1.FileNameElsefn=File1.Path+"\"+File1.FileNameEndIfEndSubPrivateSubCommand1_Click<>DimyesnoAsByteyesno=MsgBox<"确认要删除吗?",vbYesNo,"删除文件">Ifyesno=vbYesThenKillfnFile1.RefreshEndSub程序2.建立4个文本框控件依次输入姓名、出生年月、外语、计算机成绩,按"确认"按钮追加该记录到磁盘文件d:\student.dat。过程设计如下:PrivateSubCommand1_Click<>DimbAsDate,mAsByte,eAsByteOpen"d:\student.dat"ForAppendAs#1b=Text2.Text:m=Text3.Text:e=Text4.TextWrite#1,Text1.Text,b,m,eText1.Text="":Text2.Text="":Text3.Text="":Text4.Text=""Close#1EndSub程序3.界面设计如图10-11所示,过程设计如下:PrivateSubForm_Load<>DimssAsStringOpen"e:\student.txt"ForAppendAs#1'如文件不存在则先建立该文件Close#1Open"d:\student.dat"ForInputAs#1'将文件中所有记录在列表框中显示WhileNotEOF<1>LineInput#1,ss:List1.AddItemssWendClose#1'在选中表项之前"删除"、"修改"按钮不可用Command2.Enabled=False:Command3.Enabled=FalseEndSubPrivateSubList1_Click<>'选中表项后可"删除"或"修改",不可"追加"。Command1.Enabled=False:Command2.Enabled=TrueCommand3.Enabled=True:Text1.Text=List1.TextEndSubPrivateSubCommand1_Click<>'追加记录IfTrim<>""ThenList1.AddItemText1.TextText1.Text=""EndSubPrivateSubCommand2_Click<>'修改记录List1.AddItemText1.Text,List1.ListIndexList1.RemoveItemList1.ListIndexCommand1.Enabled=True:Command2.Enabled=FalseCommand3.Enabled=False:Text1.Text=""'修改后,不可"删除"、"修改"EndSubPrivateSubCommand3_Click<>'删除记录List1.RemoveItemList1.ListIndex'删除后,不可"删除"、"修改"Command1.Enabled=True:Command2.Enabled=FalseCommand3.Enabled=False:Text1.Text=""EndSubPrivateSubCommand4_Click<>'保存文件,将列表框中所有表项输出到文件DimiAsIntegerOpen"d:\student.dat"ForOutputAs#1Fori=0ToList1.ListCount-1:Print#1,List1.List:NextiClose#1EndSubPrivateSubCommand5_Click<>'退出之前先保存文件CallCommand4_Click:EndEndSub第9章数据库与数据访问技术一、判断题1.√2.√3.×4.√5.×6.×7.√8.√9.×10.×11.√12.√13.√14.√15.√16.×17.×18.×19.√20.√21.√22.×二、选择题1.A2.D3.C4.B5.C6.A7.C8.D9.D10.C11.A12.D13.A14.B15.B16.C三、程序设计题程序1.〔1数据访问控件以及数据绑定控件的相关属性设置如下Data1:Connect<"Access">、DatabaseName<"d:\学籍.mdb">、RecordSource<"学生>"Text1:DataSource<"Data1">、DataField<"学号">Text2:DataSource<"Data1">、DataField<"姓名">Check1:DataSource<"Data1">、DataField<"性别">Text3:DataSource<"Data1">、DataField<"出生日期>Text4:DataSource<"Data1">、DataField<"奖学金">Text5:DataSource<"Data1">、DataField<"简历">OLE1:DataSource<"Data1">、DataField<"照片">Adodc1:ConnectionString<"Provider=Microsoft.Jet.OLEDB.4.0;_DataSource=E:\GYH\VB\学籍1b.mdb;PersistSecurityInfo=False">CommandType<"1-adCmdText">、RecordSource<"select*from成绩">DataGrid1:DataSource<"Adodc1">〔2主要事件过程代码OptionExplicitPrivateSubForm_Load<>Caption="学籍信息编辑浏览"Label1.Caption="学号:":Label2.Caption="姓名:"Label3.Caption="出生年月:":Label4.Caption="奖学金:"Label5.Caption="简历:":Label6.Caption="照片:"Check1.Caption="性别<选中表示男,否则为女>"Label7.Caption="成绩信息查询显示":Adodc1.Visible=FalseEndSubPrivateSubData1_Reposition<>Adodc1.RecordSource="select成绩.课程号,课程名,成绩from学生,课程,成绩"_&"where学生.学号=成绩.学号and"&"成绩.课程号=课程.课程号and"&_"成绩.学号='"&Data1.Recordset<"学号">&"'"&"orderby成绩.课程号"Label7.Caption=Trim>&"成绩信息查询显示"Adodc1.RefreshEndSub程序2.〔1数据访问控件以及数据绑定控件的相关属性设置如下:Adodc1:ConnectionString<"Provider=Microsoft.Jet.OLEDB.4.0;_DataSource=E:\GYH\VB\学籍1b.mdb;PersistSecurityInfo=False"CommandType<"1-adCmdText">、RecordSource<"select*from学生>DataGrid1:DataSource<"Adodc1">〔2主要事件过程代码OptionExplicitPrivateSubForm_Load<>DimiAsIntegerCaption="学籍信息查询浏览":Adodc1.Visible=FalseLabel1.Caption="选择查询方式:":Combo1.Text="全部都显示"Label2.Caption="全部表文件数据浏览
表格
关于规范使用各类表格的通知入职表格免费下载关于主播时间做一个表格详细英语字母大小写表格下载简历表格模板下载
:":Label3.Visible=FalseText1.Visible=False:Text1.Text=""Fori=0To2Combo1.AddItemMid<"全部都显示按学号查询按姓名查询",5*i+1,5>NextiEndSubPrivateSubCombo1_Click<>SelectCaseCombo1.ListIndexCase0Text1.Visible=False:Label3.Visible=FalseAdodc1.RecordSource="select*from学生"Label2.Caption="全部表文件数据浏览表格:":Adodc1.RefreshCase1Label3.Caption="输入查询条件<学号>:":Text1.Visible=TrueLabel3.Visible=True:Text1.SetFocusCase2Label3.Caption="输入查询条件<姓名>:":Text1.Visible=TrueLabel3.Visible=True:Text1.SetFocusEndSelectEndSubPrivateSubText1_KeyDownIfKeyCode=vbKeyReturnThenIfCombo1.ListIndex=1ThenAdodc1.Recordset.Find"学号='"&Text1.Text&"'"IfAdodc1.Recordset.EOFThenAdodc1.RecordSource="select*from学生"Label2.Caption="全部表文件数据浏览表格:"Adodc1.Refresh:MsgBox"查无此人!"ElseAdodc1.RecordSource="select*from学生"&"where_学号='"&Text1.Text&"'"Label2.Caption="学生"+Text1.Text+"的数据浏览表格:"EndIfElseAdodc1.Recordset.Find"姓名='"&Text1.Text&"'"IfAdodc1.Recordset.EOFThenAdodc1.RecordSource="select*from学生"Label2.Caption="全部表文件数据浏览表格:"Adodc1.Refresh:MsgBox"查无此人!"ElseAdodc1.RecordSource="select*from学生"&_"where姓名='"&Text1.Text&"'"EndIfEndIfAdodc1.RefreshEndIfEndSub程序3.〔1数据访问控件以及数据绑定控件的相关属性设置如下:Adodc1:ConnectionString<"Provider=Microsoft.Jet.OLEDB.4.0;_DataSource=E:\GYH\VB\学籍1b.mdb;PersistSecurityInfo=False">CommandType<"2-adCmdTable">、RecordSource<"学生">Adodc2:ConnectionString<"Provider=Microsoft.Jet.OLEDB.4.0;_DataSource=E:\GYH\VB\学籍1b.mdb;PersistSecurityInfo=False">CommandType<"2-adCmdTable">、RecordSource<"课程">Adodc3:ConnectionString<"Provider=Microsoft.Jet.OLEDB.4.0;_DataSource=E:\GYH\VB\学籍1b.mdb;PersistSecurityInfo=False">CommandType<"1-adCmdText">RecordSource〔"select成绩.学号,学生.姓名,成绩.课程号,课程.课程名,_成绩.成绩from学生,课程,成绩where成绩.课程号=课程.课程号_and成绩.学号=学生.学号"DataGrid1:DataSource<"cjcx">DataList1:RowSource<"xs">、ListField<"姓名"、BoundColumn<"学号">DataList2:RowSource<"kc">、ListField<"课程名">、BoundColumn<"课程号">〔2主要事件过程代码OptionExplicitDimpAsBytePrivateSubForm_Load<>DimiAsIntegerFori=0To4Label1.Caption=Mid<"优秀良好中等及格差等",2*i+1,2>Text1.Text="":Text1.BackColor=RGB<205,205,192>Text1.Locked=TrueNexticjcx.RecordSource="select成绩.学号,学生.姓名,成绩.课程号,课程.课程名,"_&"成绩.成绩from学生,课程,成绩"&_"where成绩.课程号=课程.课程号and成绩.学号=学生.学号"cjcx.Refresh:Label2.Caption="成绩信息列表"Label3.Caption="选择学生姓名:":Label4.Caption="选择课程名:"xs.Visible=False:kc.Visible=False:cjcx.Visible=FalseCaption="学籍信息查询":p=0EndSubPrivateSubDataList1_Click<>p=0:CallcjdctjEndSubPrivateSubDataList2_Click<>p=1:CallcjdctjEndSubPrivateSubcjdctj<>Dimcjdcjs<5>AsInteger,dcaseAsByte,iAsByteIfp=0Thencjcx.RecordSource="select成绩.学号,学生.姓名,成绩.课程号,"_&"课程.课程名,成绩.成绩from学生,课程,成绩"_&"where成绩.学号='"&DataList1.BoundText&"'"_&"and<成绩.课程号=课程.课程号and"_&"成绩.学号=学生.学号>orderby成绩.课程号"Frame1.Caption="单位:门"Label2.Caption=Trim&"成绩信息列表"Elsecjcx.RecordSource="select成绩.学号,学生.姓名,成绩.课程号,"_&"课程.课程名,成绩.成绩from学生,课程,成绩"_&"where成绩.课程号='"&DataList2.BoundText&"'"_&"and<成绩.课程号=课程.课程号and"_&"成绩.学号=学生.学号>orderby成绩.学号"Frame1.Caption="单位:人"Label2.Caption=Trim&"成绩信息列表"EndIfcjcx.RefreshI