【文章內(nèi)容簡介】
3ControlSource Header3Caption證件號Column4ControlSource Header4Caption性別Column5ControlSource Header5Caption單位部門Column6ControlSource讀者信息. 住址 Header6Caption住址Column7ControlSource Header7Caption職業(yè)Column8ControlSource Header8Caption聯(lián)系電話Column9ControlSource Header9Caption未還書目Column10ControlSource Header10Caption備注按照圖示調(diào)整好這些對象的大小和位置,然后雙擊表單給這些對象添加代碼。首先給表單右邊的四個按鈕添加代碼?!安樵儭卑粹o的Click事件代碼:if =1=4tsbh=allt()zz=allt()tsmc=allt()tslb=allt()if =0=。select * from 圖書資料 where tsbh$圖書編號。.$$$圖書類別 into cursor aelseset exact on=。select * from 圖書資料 where tsbh==圖書編號。.======圖書類別 into cursor aset exact offendifelse if =2=4dzbh=allt()dzxx=allt()zjh=allt()dwbm=allt()if =0=。select * from 讀者信息 where dzbh$讀者編號。.$$$職業(yè) into cursor aelseset exact on=。select * from 讀者信息 where dzbh==讀者編號。.======職業(yè) into cursor aset exact offendifendifendif“顯示全部”按鈕的Click事件代碼:if =1=4=。select * from 圖書資料 into cursor aendif if =2=4=。select * from 讀者信息 into cursor aEndif“清空”按鈕的Click事件代碼:if =1=39。39。=39。39。=39。39。=39。39。endif if =2=39。39。=39。39。=39。39。=39。39。endif“退出”按鈕的Click事件代碼:接下來給頁框上的控件添加代碼,右擊頁框,在彈出的快捷菜單中選擇“編輯”,然后就可以選中對象添加事件代碼了。圖書資料查詢頁(Page1)中各對象代碼:“查找”按鈕的Click事件代碼:=4tsbh=allt()zz=allt()tsmc=allt()tslb=allt()if =0=。select * from 圖書資料 where tsbh$圖書編號。.$$$圖書類別 into cursor aelseset exact on=。select * from 圖書資料 where tsbh==圖書編號。.======圖書類別 into cursor aset exact offendif“清空”按鈕的Click事件代碼:=39。39。=39。39。=39。39。=39。39。讀者資料查詢頁(Page2)中各對象代碼:“查找”按鈕的Click事件代碼:=4dzbh=allt()dzxx=allt()zjh=allt()dwbm=allt()if =0=。select * from 讀者信息 where dzbh$讀者編號。.$$$職業(yè) into cursor aelseset exact on=。select * from 讀者信息 where dzbh==讀者編號。.======職業(yè) into cursor aset exact offendif“清空”按鈕的Click事件代碼:=39。39。=39。39。=39。39。=39。39。案例6:創(chuàng)建圖書管理表單案例運(yùn)行效果與操作為了實現(xiàn)圖書資料的管理和讀者信息的管理,我們用兩個案例分別學(xué)習(xí)如何制作資料管理表單,這個案例的功能是管理圖書資料的,可以通過表單上的相應(yīng)按鈕查看、添加、刪除、修改圖書資料。圖書管理表單的運(yùn)行效果如圖108所示: 圖108 圖書管理表單運(yùn)行效果制作要點 表格的ControlSource屬性設(shè)置 記錄指針的指向和定位步驟詳解新建一個表單,保存文件名為tsgl,打開“數(shù)據(jù)環(huán)境設(shè)計器”窗口,向其中添加圖書資料表。添加控件。如圖108所示添加控件,控件包括九個按鈕(Command1~ Command9)、十六個標(biāo)簽、兩個形狀控件、一個復(fù)選框、一個表格控件和十五個文本框。添加完控件后調(diào)整它們的布局。各對象屬性設(shè)置如表104所示: 表104 “tsgl”表單各對象主要屬性對象屬性屬性值說明Form1AutoCenter.BorderStyle2固定對話框Caption圖書管理Icon(自己選擇)MaxButton.NameForm1ShowTips.ShowWindow1在頂層表單中WindowType1模式Label1Caption圖書編號:AutoSize.Label1到Label16的AutoSize屬性都照此設(shè)置BackStyle0透明Label1到Label16的BackStyle屬性都照此設(shè)置FontName宋體Label1到Label16的FontName屬性都照此設(shè)置FontSize9Label11的FontSize屬性是11,其它從Label1到Label16的FontSize屬性都是9Label2Caption作 者:Label3Caption出版日期:Label4Caption借閱次數(shù):Label5Caption圖書類別:Label6Caption購買價格:Label7Caption出版社:Label8Caption入館日期:Label9Caption圖書名稱:Label10Caption備 注:Label11Caption查 詢Label12Caption圖書編號:Label13Caption作 者:Label14Caption圖書名稱:Label15Caption出版社:Label16Caption圖書類別: Text1BackColor224,224,224ControlSourceText2ControlSourceText3ControlSourceText4ControlSourceText5ControlSourceText6ControlSourceText7ControlSourceText8ControlSourceText9ControlSourceText10ControlSourceText11~ Text15ControlSource無Check1Caption模糊查找AutoSize.Shape1~ Shape2BackStyle0透明SpecialEffect03維Command1Caption查 找Command2Caption清 空Command3Caption上一條Command4Caption下一條Command5Caption刪 除Command6Caption退 出Command7Caption增 加Command8Caption末 條Command9Caption首 條 Grid1ColumnCount3表格列數(shù)BackColor237,237,226 表格背景Column1ControlSource Header1Caption.圖書編號Column2ControlSource Header2Caption圖書名稱Column3ControlSource Header3Caption作者代碼添加與解釋雙擊表單添加各對象的事件代碼:“查詢”按鈕的Click事件代碼:thisform. =4tsbh=allt()zz=allt()tsmc=allt()cbs=allt()tslb=allt()if =1=select * from ;圖書資料 where tsbh$圖書編號。.$$$.;tslb$圖書類別 into cursor aelseset exact on=select * from ;圖書資料 where tsbh==圖書編號。.======出版社;.==圖書類別 into cursor aset exact offendif“清空”按鈕的Click事件代碼:=39。39。=39。39。=39。39。=39。39。=39。39?!吧弦徊健卑粹o的Click事件代碼:sele 2if .() skip 1 endif“下一步”按鈕的Click事件代碼:sele 2if .() skip endif“刪除”按鈕的Click事件代碼:x=messagebox(真的刪除編號為; +allt()+的圖書嗎?,4+32+256,重要提示) if x=6 delete else return .F. endif“退出”按鈕的Click事件代碼:“增加”按鈕的Click事件代碼:sele 2append blankgo bottom“末條”按鈕的Click事件代碼:sele 2go bottom “首條”按鈕的Click事件代碼:sele 2go top案例7:創(chuàng)建讀者管理表單案例運(yùn)行效果與操作這是管理數(shù)據(jù)的另一個表單,用于管理讀者信息資料,這個表單的運(yùn)行效果和圖書管理表單基本上一樣。制作方法一樣,只不過處理的數(shù)據(jù)信息不一樣而已。運(yùn)行效果如圖109所示: 圖109 讀者管理表單運(yùn)行效果制作要點 表格的ControlSourceSype屬性 SELECT查詢語句步驟詳解新建一個表單,保存文件名為dzgl,打開“數(shù)據(jù)環(huán)境設(shè)計器”窗口,向其中添加讀者信息表。添加控件。如圖109所示添加控件,控件包括九個按鈕(Command1~ Command9)、十六個標(biāo)簽、兩個形狀控件、一個復(fù)選框、一個表格控件和十五個文本框。添加完控件后調(diào)整它們的布局。各對象屬性設(shè)置如表105所示:表105 “dzgl”表單各對象主要屬性對象屬性屬性值說明Form1AutoCenter.BorderStyle2固定對話框Caption讀者信息Icon(自己選擇)MaxButton.NameForm1ShowTips.ShowWindow1在頂層表單中WindowType1模式Label1Caption讀者編號:AutoSize.Label1到Label16的AutoSize屬性都照此設(shè)置BackStyle0透明Label1到Label16的BackStyle屬性都照此設(shè)置FontName宋體Label1到Label16的FontName屬性都照此設(shè)置FontSize9Label11的FontSize屬性是11,其它從Label1到Label16的FontSize屬性都是9Label2Caption讀者姓名:Label3Caption證件號:Label4Caption性別:Label5Caption單位部門:Label6Caption住址:Label7Caption職業(yè):Label8Caption聯(lián)系電話:Lab