Form_Activate与Form_Load小问题??

genius00 2003-10-20 02:29:24
各位高手,
过程是这样:
Form_Load()
..........
Form_Activate()
Do
aa()
bb()
cc()
Loop Until 1
..........

Form_Unload()
........

奇怪现象:
窗体关闭后,窗体又会打开??如何是好啊??
...全文
451 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
genius00 2003-10-21
  • 打赏
  • 举报
回复
楼上各位高手,
另外一个小问题:
在窗体中有ACITVATE()运行时,鼠标会不断闪烁,怎么办啊!!!
wu_yongcai 2003-10-21
  • 打赏
  • 举报
回复
是不是在Form_Unload里面又操作了你要Unload窗体的属性,方法??
genius00 2003-10-21
  • 打赏
  • 举报
回复
我的想法是VB6没线程的,ACTIVATE()是一个后台线程
kmzs 2003-10-21
  • 打赏
  • 举报
回复
您想干嘛?死机玩?
j4sxw 2003-10-21
  • 打赏
  • 举报
回复
Form_Activate()内是死循环!!
aha99 2003-10-21
  • 打赏
  • 举报
回复
你在 Active 里面是死循环,你把的循环条件改为用一个boolean 值控制,在unload里面使用该值跳出循环。
genius00 2003-10-21
  • 打赏
  • 举报
回复
Private Sub Form_Activate()
Dim i, j As Integer
Do
For i = 0 To 2
Call fq(i) ''''等同于X=1语句
Call zz(i)
If Vehicle(i).Finish Then
DoEvents
Exit For
End If
DoEvents
Next i
DoEvents
Loop While True
End Sub
Private Sub Form_Load()
Dim i As Integer

LineCard = "001"
'zdxz = True
Me.Height = Screen.Height
Me.Width = Screen.Width

On Error GoTo ErrHandler

cn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Mtc;Password='hqztjx';Mode=Read|Write"
rstBasic.Open "BasicNow", cn, adOpenDynamic, adLockOptimistic, 2
Do While Not rstBasic.EOF
If (DatePart("yyyy", rstBasic.Fields(16)) = DatePart("yyyy", Date)) And (DatePart("m", rstBasic.Fields(16)) = DatePart("m", Date)) And (DatePart("d", rstBasic.Fields(16)) = DatePart("d", Date)) Then
Combo4.AddItem rstBasic.Fields(0)
Combo(2).AddItem rstBasic.Fields(5)
End If
rstBasic.MoveNext
Loop
cn.Close
End Sub

Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer

For i = 0 To 2
Tips i, "请等候" '上灯牌显示
Next i
For i = 3 To 4
TipsOld i, " 请等候" '上灯牌显示
Next
Unload Me

OtherForm.show ''其它的窗体打开

End Sub

现象是:Unload后会运行Load()
genius00 2003-10-21
  • 打赏
  • 举报
回复
高手们,如何解决啊???????/
liuyi3000 2003-10-21
  • 打赏
  • 举报
回复
用Form_Activate()好象就会闪动
flc 2003-10-20
  • 打赏
  • 举报
回复
我以前也遇见过这种现象,可能的原因是你的程序在UNLOAD里重载了。请仔细的看看你的代码,要不就帖出来吧!
genius00 2003-10-20
  • 打赏
  • 举报
回复
楼上的高手,你的方法还是不灵啊!
hemeijun81 2003-10-20
  • 打赏
  • 举报
回复
是不是你还调用该窗体,好好查查代码
genius00 2003-10-20
  • 打赏
  • 举报
回复
窗体无用TIMER控件,
aa(),bb(),cc()是一般函数,就当是赋值函数吧
guoyx 2003-10-20
  • 打赏
  • 举报
回复
1、你该窗体是否用到timer控件
2、你的aa() bb() cc()是什么?函数?里面代码是什么?
genius00 2003-10-20
  • 打赏
  • 举报
回复
楼上的高手,你的方法还是不灵啊!
Cancel=0还是关不了,会自动打开的.

如何是好啊??

另外,窗体正常打开状态时,鼠标会闪动!!!!
aiur2000 2003-10-20
  • 打赏
  • 举报
回复
你看unload下有个参数,你看有没有设置它为1,如果为1,就是不关。
射天狼 2003-10-20
  • 打赏
  • 举报
回复
你循环没结束吧,是死循环!!
VB电子相册 电子相册 1、数据库连接 Public conn As ADODB.Connection Public Sub conDB() Set conn = New ADODB.Connection conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _ & App.Path & "\data\pic.mdb" conn.Open End Sub 2、登录模块 Dim loginTimes As Integer Private rsmc As ADODB.Recordset Private rs As ADODB.Recordset Public userName As String Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdOK_Click() Call login End Sub Private Sub Form_Activate() Call conDB Set rsmc = New ADODB.Recordset rsmc.CursorLocation = adUseClient rsmc.Open "用户信息表", conn, 0, 1 'need to learn cbUserName.Clear While Not rsmc.EOF cbUserName.AddItem rsmc.Fields("用户名") rsmc.MoveNext Wend cbUserName.SetFocus tbPwd.Text = "" cbUserName.Refresh End Sub Private Sub Form_Unload(Cancel As Integer) conn.Close Set rs = Nothing End Sub Sub login() Dim strSql As String userName = "" If Trim(cbUserName.Text) = "" Then MsgBox "用户名不用为空,请选择用户名!", vbOKOnly + vbExclamation, "警告" cbUserName.SetFocus Else strSql = "select * from 用户信息表 where 用户名='" & Trim(cbUserName.Text) & "'" Set rs = New ADODB.Recordset rs.Open strSql, conn, 2, 2 If Trim(rs.Fields("密码")) = Trim(tbPwd.Text) Then rs.Close Me.Hide userName = Trim(cbUserName.Text) 'Load frmMain frmMain.Show Exit Sub Else MsgBox "密码不对,请重新输入!", vbOKOnly + vbExclamation, "警告" tbPwd.Text = "" tbPwd.SetFocus End If loginTimes = loginTimes + 1 If loginTimes = 3 Then MsgBox "密码错误已有3次,你不能进入系统!", vbOKOnly + vbQuestion, "提示" Unload Me End If End If End Sub 3、主模块 Private rs As ADODB.Recordset Dim stuNum As Integer Private Sub Form_Activate() Call conDB End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) conn.Close Set conn = Nothing End Sub Private Sub mnuAddPic_Click() frmAddPic.Show End Sub Private Sub mnuDeletePic_Click() frmDeletePic.Show End Sub Private Sub mnuShowpic_Click() frmShow.Show End Sub Private Sub mnuExit_Click() Unload Me End End Sub Private Sub mnuSMPic_Click() frmSMPic.Show End Sub Private Sub mnuUser_Click() Dim frm1 As New frmUser frm1.Show End Sub 4、显示图片模块 Dim str As String Dim rs As ADODB.Recordset Dim rsNum As Integer Dim nextNum As Integer Private Sub cbPic_Click() str = App.Path + "\" Set rs = New ADODB.Recordset Dim strConn As String strConn = "select * from pic where name='" + Trim(cbPic.Text) + "'" rs.Open strConn, conn, 0, 1 str = str + rs.Fields("address").Value 'MsgBox str Image1.Picture = LoadPicture(str) rs.Close End Sub Private Sub CmdNext_Click() nextNum = nextNum + 1 'MsgBox nextNum If nextNum > rsNum - 1 Then nextNum = 0 'MsgBox nextNum End If Dim temp As Integer temp = nextNum Set rs = New ADODB.Recordset rs.Open "pic", conn, 0, 1 ' rs.MoveFirst ' While Not rs.EOF And temp > 0 ' 'rs.MoveNext ' 'temp = temp - 1' ' Wend rs.Move (temp) str = App.Path + "\" str = str + rs.Fields("address").Value cbPic.Text = rs.Fields("name").Value Image1.Picture = LoadPicture(str) rs.Close End Sub Private Sub Form_Load() Call conDB str = App.Path + "\" nextNum = 0 Set rs = New ADODB.Recordset rs.Open "pic", conn, 0, 1 str = str + rs.Fields("address").Value Image1.Picture = LoadPicture(str) cbPic.Clear rsNum = 0 'MsgBox rsNum rs.MoveFirst While Not rs.EOF cbPic.AddItem rs.Fields("name") rsNum = rsNum + 1 rs.MoveNext Wend cbPic.Text = "tu1" rs.Close End Sub
public bz &&定义全局变量bz=.f.this.listview1.view=2 &&设置视图显示方式 *将ImageList控件图片赋予Listview控件 this.listview1.Icons=this.imagelist1.objectthis.listview1.smallicons=this.imagelist1.object&&添加列表项key=‘小区信息生成‘=this.listview1.listitems.add(,,key,,1)key=‘大楼信息生成‘=this.listview1.listitems.add(,,key,,1)key=‘房屋信息生成‘=this.listview1.listitems.add(,,key,,1)key=‘小区信息登记‘=this.listview1.listitems.add(,,key,,1)key=‘大楼信息登记‘=this.listview1.listitems.add(,,key,,1)key=‘房屋信息登记‘=this.listview1.listitems.add(,,key,,1)key=‘系统数据设定‘=this.listview1.listitems.add(,,key,,1)在“经营部”的click事件中添加代码为:this.parent.listview1.listItems.clear &&清除数据this.parent.listview1.view=2 &&设置视图显示方式*将ImageList控件图片赋予Listview控件this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.object*添加数据项key=‘小区信息生成‘=this.parent.listview1.listitems.add(,,key,,1)key=‘大楼信息生成‘=this.parent.listview1.listitems.add(,,key,,1)key=‘房屋信息生成‘=this.parent.listview1.listitems.add(,,key,,1)key=‘小区信息登记‘=this.parent.listview1.listitems.add(,,key,,1)key=‘大楼信息登记‘=this.parent.listview1.listitems.add(,,key,,1)key=‘房屋信息登记‘=this.parent.listview1.listitems.add(,,key,,1)key=‘系统数据设定‘=this.parent.listview1.listitems.add(,,key,,1)在“管理部”的事件中添加以下代码为:this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘业主信息登记‘=this.parent.listview1.listitems.add(,,key,,2)key=‘人口信息查询‘=this.parent.listview1.listitems.add(,,key,,2)key=‘小区投诉登记‘=this.parent.listview1.listitems.add(,,key,,2)key=‘小区投诉查询‘=this.parent.listview1.listitems.add(,,key,,2)key=‘小区员工管理‘=this.parent.listview1.listitems.add(,,key,,2)key=‘系统数据设定‘=this.parent.listview1.listitems.add(,,key,,2)pjyb=.t.在“工程部”上添加代码为:this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘装修队登记‘=this.parent.listview1.listitems.add(,,key,,3)key=‘维修信息登记‘=this.parent.listview1.listitems.add(,,key,,3)key=‘维修信息查询‘=this.parent.listview1.listitems.add(,,key,,3)key=‘装修信息登记‘=this.parent.listview1.listitems.add(,,key,,3)key=‘装修信息查询‘=this.parent.listview1.listitems.add(,,key,,3)pjyb=.t.在“财务部”添加代码为:this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘收费登记管理‘=this.parent.listview1.listitems.add(,,key,,4)key=‘水费查询管理‘=this.parent.listview1.listitems.add(,,key,,4)key=‘电费查询管理‘=this.parent.listview1.listitems.add(,,key,,4)key=‘煤气费查询管理‘=this.parent.listview1.listitems.add(,,key,,4)key=‘采暖费查询管理‘=this.parent.listview1.listitems.add(,,key,,4)key=‘其它费用查询管理‘=this.parent.listview1.listitems.add(,,key,,4)pjyb=.t.在“保安部”添加代码为:这this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘保安排班管理‘=this.parent.listview1.listitems.add(,,key,,5)key=‘保安排班查询‘=this.parent.listview1.listitems.add(,,key,,5)pjyb=.t.在“经理室”添加代码为:this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘小区资源统计‘=this.parent.listview1.listitems.add(,,key,,6)key=‘业主信息查询‘=this.parent.listview1.listitems.add(,,key,,6)key=‘人口信息查询‘=this.parent.listview1.listitems.add(,,key,,6)key=‘小区投诉查询‘=this.parent.listview1.listitems.add(,,key,,6)key=‘小区员工查询‘=this.parent.listview1.listitems.add(,,key,,6)key=‘装修信息查询‘=this.parent.listview1.listitems.add(,,key,,6)key=‘维修信息查询‘=this.parent.listview1.listitems.add(,,key,,6)key=‘保安排班查询‘=this.parent.listview1.listitems.add(,,key,,6)pjyb=.t.在“系统管理”中添加代码为:this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘操作员管理‘=this.parent.listview1.listitems.add(,,key,,7)key=‘权限设置‘=this.parent.listview1.listitems.add(,,key,,7)pjyb=.t.在“帮助”中添加代码为:this.parent.listview1.listItems.clearthis.parent.listview1.view=2this.parent.listview1.Icons=this.parent.imagelist1.objectthis.parent.listview1.smallicons=this.parent.imagelist1.objectkey=‘帮助‘=this.parent.listview1.listitems.add(,,key,,8)key=‘关于本软件‘=this.parent.listview1.listitems.add(,,key,,8)pjyb=.t.在“退出”中添加代码为:quit &&退出主程序在Image1的Click事件中添加代码为:this.parent.commdl.filter=‘图片|*.bmp;*.jpg‘ &&设置过滤器this.parent.commdl.showopen &&显示打开对话框this.parent.rq.image2.picture=this.parent.commdl.filename &&显示选定文件的名字3.系统等录界面的设计在项目管理器中添加一个新的表单,名称为Admain在表单中添加一个ImageList 控件,并进行相应的管理员设置。在表单中添加一个Image控件,一个listview控件,一个ImageList控件,两个text控件,三个label控件,一个commandgroup控件。在表单中的init事件中添加代码为:public cn &&定义全局变量cn=0 &&给全局变量赋初值thisform.listview1.view=0 &&设置视图显示方式*将ImageList控件图片赋予Listview控件thisform.listview1.Icons=thisform.imagelist1.objectthisform.listview1.smallicons=thisform.imagelist1.objectselect tabpurview &&选定tabpurview工作区为当前工作区select *;from wuyemanage!tabpurview;where 权限级别=‘1‘;order by tabpurview.操作员姓名;into cursor sysglythisform.text2.value=sysgly.操作员姓名thisform.text1.value=‘‘key=alltrim(sysgly.操作员姓名) &&赋值给变量key=thisform.listview1.listitems.add(,,key,1) &&添加一个列表项select tabpurviewselect *;from wuyemanage!tabpurview;where 权限级别=‘2‘;order by tabpurview.操作员姓名;into cursor gjczydo while !EOF() &&测试当前记录指针是否在文件尾 key=alltrim(gjczy.操作员姓名) =thisform.listview1.listitems.add(,,key,2) &&添加一个列表项 skip &&相对移动记录指针enddoselect tabpurviewselect *;from wuyemanage!tabpurview;where 权限级别=‘3‘;order by tabpurview.操作员姓名;into cursor ybczydo while !EOF() &&测试当前记录指针是否在文件尾 key=alltrim(ybczy.操作员姓名) =thisform.listview1.listitems.add(,,key,3) &&添加一个列表项 skip &&相对移动记录指针enddoselect tabpurviewselect *;from wuyemanage!tabpurview;where 权限级别=‘4‘;order by tabpurview.操作员姓名;into cursor zdydo while !EOF() &&测试当前记录指针是否在文件尾 key=alltrim(zdy.操作员姓名) =thisform.listview1.listitems.add(,,key,4) &&添加一个列表项 skip &&相对移动记录指针enddo在表单的resize事件中添加代码为:purview=val(alltrim(tabpurview.权限级别)) &&根据用户选择设置权限级别pjyb=tabpurview.经营部pglb=tabpurview.管理部pgcb=tabpurview.工程部pcwb=tabpurview.财务部pbab=tabpurview.保安部pjls=tabpurview.经理室psysgl=tabpurview.系统管理manager=alltrim(thisform.text2.value)do form formfdesktop &&调入表单fdesktopthisform.release &&刷新表单在等录的click事件中添加代码为:if empty(操作员姓名) &&判断操作员字段是否为空 thisform.resize &&执行表单的Resize事件 store .t.to pjyb,pglb,pgcb,pcwb,pbab,pjls,psysgl &&给多个内存变量赋予相同的值else seek cname &&查找输入的操作员姓名 set exact on &&设置字符精确比较*判断密码是否正确 if alltrim(tabpurview.密码)!=ppassword cn=cn+1 cmessagetitle=‘系统登录‘ cmessagetext=‘密码错误,请重新输入!‘ ndialogtype=4+32 nanswer=messagebox(cmessagetext,ndialogtype,cmessagetitle) do case case nanswer=6 thisform.text1.value=‘‘ thisform.text1.setfocus &&文本框获得焦点 case nanswer=7 messagebox(‘不要乱来!‘,48,‘系统登录‘) thisform.release &&释放表单 endcase if cn=3 thisform.release endif else thisform.resize &&执行表单的Resize事件 endif endifset exact off &&设置字符非精确比较在取消的click事件中添加代码为:cmessagetitle=‘系统登录‘cmessagetext=‘真的想要退出吗?‘nDialogtype=4+32nanswer=messagebox(cMessagetext,nDialogtype,cMessagetitle)if nanswer=6 quitendif在控件listview1中的itemclick事件中添加代码为:LPARAMETERS itemmanager=alltrim(thisform.listview1.selecteditem.text)thisform.text2.value=managerthisform.text1.setfocus 这样,等录界面就完成了。4.经营部设计(1)在项目管理器中创建一个表单,名称为“小区信息生成”,在表单中添加3个label控件,2个spinner控件,1个commandgroup控件。在“开始生成”的click事件中添加代码为:cstart=thisform.spinner1.valuecend=thisform.spinner2.values=alltrim(str(cstart))e=alltrim(str(cend))cpicture=sys(5)+sys(2003)+‘imagesemptyimage.bmp‘cmessagetitle=‘小区信息生成‘cmessagetext=‘确认生成编号为 ‘+s+‘至 ‘+e+‘的小区信息吗?‘ndialogtype=4+32nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle)do case case nAnswer=6 i=1 for i=cstart to cend xqno=alltrim(str(i)) select *; from databasewuyemanage!tabxqinfo; where 小区编号==xqno; into cursor lindep if reccount()=0*追加新记录 insert into tabxqinfo values(xqno,‘‘,‘‘,‘‘,0,0,0,0,0,0,‘‘,‘‘,cpicture,ctod(‘‘),ctod(‘‘)) endif endfor messagebox(‘数据保存成功!‘,48,‘小区信息生成‘) thisform.release do form form小区信息登记 &&调入表单 case nAnswer=7 thisform.spinner1.setfocusendcase在“返回主系统”中的click事件中添加代码为:thisform.release &&释放表单(2)在项目管理器中添加一个新的表单名称为“大楼信息生成器”,在表单中添加9个label控件,1个combo控件,2个spinner控件,4个text控件。说明:其编法如(1)(3)在项目管理器中新建一个表单,名称为“房屋信息生成器”,在表单中添加13个label控件,6个combo控件,1个text控件,4个spinner控件,1个commandgroup控件,1个grid控件。说明:其编法如(1)(4)在项目管理器中添加一个新的表单集包含form1,gorm2,名称为“小区信息登记”。在form1表单中添加16个label控件,13个text控件,1个edit控件,2个commandgroup控件,1个common dialog控件,1个image控件,2个command控件,在form2表单中添加1个command控件,1个grid控件。在form1中的load事件中添加代码为:public l &&定义全局变量l=.f.在form1中的activate事件中添加代码为:thisform.text1.value=tabxqinfo.小区编号 &&赋值给Text1thisform.text2.value=tabxqinfo.小区名称thisform.text3.value=tabxqinfo.负责人thisform.text4.value=tabxqinfo.小区说明thisform.text5.value=tabxqinfo.交工日期thisform.text6.value=tabxqinfo.竣工日期thisform.text7.value=tabxqinfo.地址thisform.text8.value=tabxqinfo.占地面积thisform.text9.value=tabxqinfo.建筑面积thisform.text10.value=tabxqinfo.绿化面积thisform.text11.value=tabxqinfo.居住面积thisform.text12.value=tabxqinfo.楼栋数thisform.text13.value=tabxqinfo.总户数thisform.edit1.value=tabxqinfo.备注thisform.container1.image1.picture=tabxqinfo.照片thisform.refresh在form1中的init事件中添加代码为:store l to thisform.text1.enabled,thisform.text2.enabled,thisform.text3.enabled,; thisform.text4.enabled,thisform.text5.enabled,thisform.text6.enabled,; thisform.text7.enabled,thisform.text8.enabled,thisform.text9.enabled,; thisform.text10.enabled,thisform.text11.enabled,thisform.text12.enabled,; thisform.text13.enabled,thisform.edit1.enabled,thisform.badd.enabled,; thisform.bclear.enabled &&设置控件是否有效在form1中的“添加”click事件中添加代码为:if alltrim(thisform.commandgroup1.command1.caption)=‘添 加‘ thisform.commandgroup1.command1.caption=‘保 存‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘取 消‘ thisform.commandgroup1.command3.enabled=.f. thisform.commandgroup1.command4.enabled=.f.*设置控件有效 l=.t. thisform.init &&执行表单的Init事件 store ‘‘ to thisform.text1.value,thisform.text2.value,thisform.text3.value,; thisform.text4.value,thisform.text7.value store {//} to thisform.text5.value,thisform.text6.value store 0 to thisform.text8.value,thisform.text9.value,thisform.text10.value,; thisform.text11.value,thisform.text12.value,thisform.text13.value thisform.edit1.value=‘‘ thisform.container1.image1.picture=sys(5)+sys(2003)+‘imagesemptyimage.bmp‘ thisform.text1.setfocuselse thisform.commandgroup1.command1.caption=‘添 加‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘修 改‘ thisform.commandgroup1.command3.enabled=.t. thisform.commandgroup1.command4.enabled=.t.*获取输入信息 xqno=alltrim(thisform.text1.value) xqname=alltrim(thisform.text2.value) xqinfo=alltrim(thisform.text4.value) fzr=alltrim(thisform.text3.value) jiaogdate=thisform.text5.value jungdate=thisform.text6.value area=alltrim(thisform.text7.value) cmemo=alltrim(thisform.edit1.value) zdmj=thisform.text8.value jzmj=thisform.text9.value lhmj=thisform.text10.value juzmj=thisform.text11.value lds=thisform.text12.value zhs=thisform.text13.value cpicture=thisform.container1.image1.picture select *; from wuyemanage!tabxqinfo; where 小区编号==xqno; order by 小区编号; into cursor lindep if reccount()=0 insert into tabxqinfo values(xqno,xqname,xqinfo,fzr,lds,zhs,jzmj,juzmj,zdmj,; lhmj,area,cmemo,cpicture,jungdate,jiaogdate) &&追加新记录 messagebox(‘数据保存完毕!‘,48,‘操作成功!‘) else cmessagetitle=‘小区信息登记‘ cmessagetext=‘信息已修改,确定要保存吗?‘ ndialogtype=4+32 nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle) do case case nAnswer=6 update wuyemanage!tabxqinfo set 小区名称=xqname,小区说明=xqinfo,负责人=fzr,; 楼栋数=lds,总户数=zhs,建筑面积=jzmj,居住面积=juzmj,占地面积=zdmj,地址=area,; 备注=cmemo,照片=cpicture,竣工日期=jungdate,交工日期=jiaogdate,绿化面积=lhmj ; where 小区编号==xqno &&更新数据表 messagebox(‘数据保存完毕!‘,48,‘操作成功!‘) endcase endif select tabxqinfo l=.f. thisform.init &&执行表单的Init事件 thisform.activate &&执行表单的Activate事件endif在form1中的“修改”click事件中添加代码为:if alltrim(thisform.commandgroup1.command2.caption)=‘修 改‘ thisform.commandgroup1.command1.caption=‘保 存‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘取 消‘ thisform.commandgroup1.command3.enabled=.f. thisform.commandgroup1.command4.enabled=.f. l=.t. thisform.init &&执行表单的Init事件 thisform.text1.enabled=.f. thisform.text1.setfocuselse thisform.commandgroup1.command1.caption=‘添 加‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘修 改‘ thisform.commandgroup1.command3.enabled=.t. thisform.commandgroup1.command4.enabled=.t. thisform.activate &&执行表单的Activate事件 l=.f. thisform.init &&执行表单的Init事件endif在form1中的“删除”click事件中添加代码为:xqnumber=alltrim(thisform.text1.value)cmessagetitle=‘小区信息登记‘cmessagetext=‘确定要删除吗?‘ndialogtype=4+32nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle)if nAnswer=6 select tabxqinfo use use database/tabxqinfo exclusive &&以独占方式打开数据表 dele from tabxqinfo where 小区编号=xqnumber &&逻辑删除记录 dele from tabxqinfo where empty(小区编号) pack &&物理删除 thisform.activate &&执行表单的Activate事件 messagebox(‘删除完毕‘,48,‘操作成功!‘) use database abxqinfo thisform.refreshendif在form1中的“浏览”click事件中添加代码为:thisform.parent.form2.grid1.recordsource=‘tabxqinfo‘ &&赋数据源thisform.parent.form2.visible=.t. &&显示表单在form1中的“退出”click事件中添加代码为:thisform.release &&释放表单thisform.parent.form2.release在form1中的“追加图片”click事件中添加代码为:thisform.imagedc.filter="图片|*.bmp;*.jpg" &&设置过滤器 thisform.imagedc.showopen &&显示打开对话框thisform.Container1.image1.picture=thisform.imagedc.filename在form1中的“清除图片”click事件中添加代码为:thisform.Container1.image1.picture=sys(5)+sys(2003)+‘imagesemptyimage.bmp‘在form1中的“第一个”click事件中添加代码为:go top &&记录指针定位到第一条记录this.parent.command1.enabled=.f.this.parent.command2.enabled=.f.this.parent.command3.enabled=.t.this.parent.command4.enabled=.t.thisform.Activate &&执行表单的Activatethisform.refresh在form1中的“上一个”click事件中添加代码为: skip-1 &&把记录指针向上移一条记录 thisform.Activate &&执行表单的Activate if bof() messagebox(‘已是第一个记录‘,48,‘信息窗口‘) this.parent.command1.enabled=.f. this.parent.command2.enabled=.f. thisform.Activate &&执行表单的Activate else this.parent.command1.enabled=.t. this.parent.command2.enabled=.t. endif this.parent.command3.enabled=.t. this.parent.command4.enabled=.t.thisform.refresh在form1中的“下一个”click事件中添加代码为:if eof() messagebox(‘已经是最后一条记录‘,48,‘管理窗口‘) skip-1 &&记录指针向上移动一条记录 thisform.Activate &&执行表单的Activate this.parent.command1.enabled=.f. this.parent.command2.enabled=.f. this.parent.command3.enabled=.f. this.parent.command4.enabled=.f.else skip &&记录指针向下移一条记录 thisform.Activate &&执行表单的Activate if eof() messagebox(‘已经是最后一条记录‘,48,‘管理窗口‘) skip-1 thisform.Activate &&执行表单的Activate this.parent.command3.enabled=.f. this.parent.command4.enabled=.f. else this.parent.command3.enabled=.t. this.parent.command4.enabled=.t. endif this.parent.command1.enabled=.t. this.parent.command2.enabled=.t.endifthisform.refresh在form1中的“最后一个”click事件中添加代码为:go bottom &&记录指针移动到最后一条记录this.parent.command3.enabled=.f.this.parent.command4.enabled=.f.this.parent.command1.enabled=.t.this.parent.command2.enabled=.t.thisform.Activate &&执行表单的Activatethisform.refresh在form1中的控件edit1的keypress事件中添加代码为:LPARAMETERS nKeyCode, nShiftAltCtrlif nKeycode=3thisform.text8.setfocusendif在form1中的控件edit1的lostfocus事件中添加代码为:thisform.text8.setfocus在form2中的“退出小区信息浏览”的click事件中添加代码为:thisform.visible=.f. &&隐藏表单(5)在项目管理器中添加一个表单集包括form1,form2,form3,名称为“大楼信息登记”。在表单form1中添加2个list控件,2个label控件,1个commandgroup控件,在表单form2中添加17个label控件,12个text控件,2个combo控件,1个edit控件,1个common dialog控件,1个image控件,2个command控件,2个commandgroup控件,在表单form3中添加1个grid控件, 1个command控件。说明:其编法如以上(4)所示(6)在项目管理器中新建表单集包含form1,form2,form3,名称为“房屋信息登记”。在表单form1中添加1个commbo控件,2个list控件,2个label控件,1个commandgroup控件,在表单form2中添加19个label控件,9个text控件,8个combo控件,1个edit控件,1个commandgroup控件,在表单form3中添加1个grid控件, 1个command控件。说明:其编法如以上(4)所示(7)在项目管理器中添加一个新的表单名称为“系统数据设定”,在表单中添加一个label控件,2个commandgroup控件。在表单的“退出系统数据设定”按钮的click事件中添加代码为:thisform.release在表单的“房屋朝向设定”按钮的click事件中添加代码为:thisform.release &&释放表单do form form房屋朝向设定 &&调入表单在表单的“权限类型设定”按钮的click事件中添加代码为:thisform.release &&释放表单do form form权属类型设定 &&调入表单在表单的“小区部门设定”按钮的click事件中添加代码为:thisform.release &&释放表单do form form小区部门设定 &&调入表单在表单的“员工种类设定”按钮的click事件中添加代码为:thisform.release &&释放表单do form form员工种类设定 &&调入表单元在表单的“费用科目及费用标准设定”按钮的click事件中添加代码为:thisform.release &&释放表单do form form费用科目及费用标准设定 &&调入表单(8)在项目管理器中添加一个新的表单名称为“房屋朝向设计”,表单中添加3个label控件,1个text控件,1个grid控件,1个commandgroup控件。在表单的init事件中添加以下代码:thisform.text1.controlsource=‘tabfrontage.房屋朝向‘ &&赋数据源thisform.grid1.recordsource=‘tabfrontage‘ &&赋数据源在“添加”按钮的click事件中添加代码为:if thisform.commandgroup1.command1.caption=‘添 加‘ thisform.commandgroup1.command1.caption=‘保 存‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘取 消‘ &&赋值给Command2的标题文本 append blank &&追加新记录 thisform.text1.value=‘‘ thisform.text1.setfocuselse thisform.commandgroup1.command1.caption=‘添 加‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘删 除‘ &&赋值给Command2的标题文本endifthisform.refresh &&刷新表单在“删除”按钮的click事件中添加代码为:if thisform.commandgroup1.command2.caption=‘取 消‘ thisform.commandgroup1.command1.caption=‘添 加‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘删 除‘ &&赋值给Command2的标题文本 cx=alltrim(thisform.text1.value) select tabfrontage &&选择Tabfrontage工作区为当前工作区 use &&关闭数据表 use database/tabfrontage exclusive &&以独占方式打开数据表 dele from tabfrontage where 房屋朝向==cx &&逻辑删除记录 dele from tabfrontage where empty(房屋朝向) &&逻辑删除记录 pack &&物理删除 thisform.text1.value=tabfrontage.房屋朝向 use database abfrontage &&打开数据表 else cx=alltrim(thisform.text1.value) select tabfrontage use use database/tabfrontage exclusive &&以独占方式打开数据表 dele from tabfrontage where 房屋朝向==cx &&逻辑删除记录 dele from tabfrontage where empty(房屋朝向) &&逻辑删除记录 pack &&物理删除 thisform.text1.value=tabfrontage.房屋朝向 messagebox(‘删除完毕‘,48,‘操作成功!‘) use database abfrontage &&打开数据表 endif thisform.init &&执行表单的Init事件在text1的click事件中添加代码为:thisform.text1.controlsource=‘tabfrontage.房屋朝向‘thisform.text1.value=alltrim(thisform.grid1.column1.text1.value)(9)在项目管理器中添加一个新的表单名称为“费用科目及费用标准设定设计”,表单中添加4个label控件,2个text控件,1个grid控件,1个commandgroup控件。说明:其编法如以上(8)所示5.管理部设计(1)在项目管理器中添加一个表单集,含有form1,form2.,form3,form4,名称为“业主信息登记”在表单form1中添加1个combo控件,1个list控件,5个label控件,1个commandgroup控件,3个text控件,2个grid控件,1个command控件,1个optioguoup控件。在表单form2中添加1个grid控件, 1个command控件。在表单form3中添加24个label控件,15个text控件,3个combo控件,4个date and time picker控件,1个commandgroup控件,1个grid控件,在表单form4中添加23个label控件,13个text控件,8个combo控件,1个edit控件,1个commandgroup控件。在form1的init事件中添加以下代码:public date1,date2,date3,date4 &&定义全局变量store ctod(‘03/22/2003‘) to date1,date2,date3,date4store .f. to thisform.parent.form3.visible,thisform.parent.form4.visible &&隐藏表单thisform.grid1.columncount=1 &&指定表格的列对象的数目thisform.grid1.column1.header1.caption=‘大楼名称‘store ‘‘ to thisform.grid1.recordsource,thisform.grid1.column1.controlsource,; thisform.list1.controlsource,thisform.list1.rowsource,thisform.grid3.recordsource在form1表单的“小区名称”组合框的interactivechange事件中添加以下代码:thisform.init &&执行表单的Init事件xqname=alltrim(thisform.combo1.displayvalue)select *;from databasewuyemanage!tabdlinfo;where 所属区域==xqname;into cursor lindepingthisform.grid1.columncount=1 &&指定表格的列对象的数目thisform.grid1.column1.header1.caption=‘大楼名称‘thisform.grid1.column1.width=154thisform.grid1.recordsource=‘lindeping‘ &&赋数据源thisform.grid1.column1.controlsource=‘lindeping.大楼名称‘&&赋数据源thisform.refresh 在form1表单的“添加新业主”按钮的click事件中添加代码为:yxq=alltrim(thisform.combo1.displayvalue)ydl=alltrim(thisform.text1.value)yfw=alltrim(thisform.text2.value)if empty(yxq) or empty(ydl) or empty(yfw) messagebox(‘请选择小区名称、大楼名称和房屋编号!‘,48,‘操作失败‘)else select tabyzinfo locate for 购入房编号=yfw &&顺序查询 if found() messagebox(‘此房屋已住人!‘,48,‘业主信息登记‘) else thisform.parent.form3.visible=.t. &&显示表单 lfjno=len(yxq)+len(ydl)+1 fjno=substr(yfw,lfjno) thisform.parent.form3.text1.value=yxq thisform.parent.form3.text2.value=ydl thisform.parent.form3.text3.value=fjno thisform.parent.form3.text4.value=yfw thisform.parent.form3.text5.value=yfw store ‘‘ to thisform.parent.form3.text6.value,thisform.parent.form3.text7.value,; thisform.parent.form3.text8.value,thisform.parent.form3.text9.value,; thisform.parent.form3.text10.value,thisform.parent.form3.text11.value,; thisform.parent.form3.text12.value,thisform.parent.form3.text13.value,; thisform.parent.form3.text14.value,thisform.parent.form3.combo1.value,; thisform.parent.form3.combo2.value,thisform.parent.form3.combo3.value thisform.parent.form3.grid1.recordsource=‘‘ thisform.parent.form3.text5.setfocus &&Text5获得焦点 endifendif在form1表单的“修改业主信息”按钮的click事件中添加代码为:cvalue=alltrim(thisform.text3.value)if !empty(cvalue)thisform.parent.form3.visible=.t.public yzdh &&定义全局变量yzdh=alltrim(thisform.text3.value)select *;from wuyemanage!tabyzinfo;where 业主代号==yzdh;into cursor lxgyzinfo*赋值给Text1等thisform.parent.form3.text1.value=lxgyzinfo.小区名称thisform.parent.form3.text2.value=lxgyzinfo.大楼名称thisform.parent.form3.text3.value=lxgyzinfo.房间号码thisform.parent.form3.text4.value=lxgyzinfo.购入房编号thisform.parent.form3.text5.value=lxgyzinfo.业主代号thisform.parent.form3.text6.value=lxgyzinfo.业主姓名thisform.parent.form3.text7.value=lxgyzinfo.手机thisform.parent.form3.text8.value=lxgyzinfo.管理协议书编号thisform.parent.form3.text9.value=lxgyzinfo.电话thisform.parent.form3.text10.value=lxgyzinfo.购房合同书编号thisform.parent.form3.text11.value=lxgyzinfo.联系地址thisform.parent.form3.text12.value=lxgyzinfo.证件号thisform.parent.form3.text13.value=lxgyzinfo.单位电话thisform.parent.form3.text14.value=lxgyzinfo.工作单位thisform.parent.form3.combo1.value=lxgyzinfo.性别thisform.parent.form3.combo2.value=lxgyzinfo.是否进住thisform.parent.form3.combo3.value=lxgyzinfo.证件名*赋值给date and time picker 控件thisform.parent.form3.date1.year=year(lxgyzinfo.签约日期)thisform.parent.form3.date1.month=month(lxgyzinfo.签约日期)thisform.parent.form3.date1.day=day(lxgyzinfo.签约日期)thisform.parent.form3.date2.year=year(lxgyzinfo.进住起始日期)thisform.parent.form3.date2.month=month(lxgyzinfo.进住起始日期)thisform.parent.form3.date2.day=day(lxgyzinfo.进住起始日期)thisform.parent.form3.date3.year=year(lxgyzinfo.进住日期)thisform.parent.form3.date3.month=month(lxgyzinfo.进住日期)thisform.parent.form3.date3.day=day(lxgyzinfo.进住日期)thisform.parent.form3.date4.year=year(lxgyzinfo.进住截止日期)thisform.parent.form3.date4.month=month(lxgyzinfo.进住截止日期)thisform.parent.form3.date4.day=day(lxgyzinfo.进住截止日期)select *;from wuyemanage!tabrkinfo;where 房间编号==alltrim(thisform.parent.form3.text4.value);order by 人口编号;into cursor lincythisform.parent.form3.grid1.recordsource=‘lincy‘ &&赋数据源thisform.parent.form3.text5.setfocus &&Text5获得焦点else messagebox(‘请选择业主代号!‘,48,‘业主信息登记‘)endif在form1表单的“删除业主信息”按钮的click事件中添加代码为:yzno=alltrim(thisform.text3.value)cmessagetitle=‘业主信息登记‘cmessagetext=‘确定要删除吗?‘ndialogtype=4+32nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle)if nAnswer=6 select tabyzinfo use use database/tabyzinfo exclusive &&以独占的方式打开数据表 dele from tabyzinfo where 业主代号==yzno &&逻辑删除 dele from tabyzinfo where empty(业主代号) pack &&物理删除 update wuyemanage!tabfwinfo set 房主代号=‘‘,房主姓名=‘‘,是否空闲=.t.,房屋状态=‘空闲‘ ; where 房主代号==yzno &&更新数据表 messagebox(‘删除完毕‘,48,‘操作成功!‘) use database abyzinfo thisform.optiongroup1.interactivechange &&执行Optiongroup1的Interactionchange事件 thisform.text3.value=‘‘ thisform.refreshendif在form1表单的“退出业主登记管理”按钮的click事件中添加代码为:thisform.release &&释放表单thisform.parent.form2.releasethisform.parent.form3.releasethisform.parent.form4.release在form1表单的optiongroup1选项按钮组的interactivechange事件中添加代码为:do case case thisform.optiongroup1.option1.value=1 select *; from wuyemanage!tabyzinfo; where 大楼名称==alltrim(thisform.text1.value); into cursor linall thisform.grid3.recordsource=‘linall‘ &&赋数据源 case thisform.optiongroup1.option2.value=1 select *; from wuyemanage!tabyzinfo; where 是否进住==‘已进住‘ and 大楼名称==alltrim(thisform.text1.value); into cursor liny thisform.grid3.recordsource=‘liny‘ &&赋数据源 case thisform.optiongroup1.option3.value=1 select *; from wuyemanage!tabyzinfo; where 是否进住==‘未进住‘and 大楼名称==alltrim(thisform.text1.value); into cursor linw thisform.grid3.recordsource=‘linw‘endcase在form1的“查看房屋详细信息”按钮的click事件中添加以下代码:dlname=alltrim(thisform.text1.value)if !empty(dlname) select *; from database abfwinfo; where 大楼名称==dlname; into cursor lin if reccount()=0 messagebox(‘请先生成大楼[‘+dlname+‘]的房屋信息!‘,48,‘操作失败‘) else thisform.parent.form2.grid1.recordsource=‘lin‘ &&赋数据源 endifelse thisform.parent.form2.grid1.recordsource=‘tabfwinfo‘endifthisform.parent.form2.visible=.t. &&显示表单在form1的list1控件的click事件中添加以下代码:thisform.text2.value=alltrim(thisform.list1.displayvalue)在form1的text1控件的click事件中添加以下代码:thisform.text3.value=alltrim(thisform.grid3.column1.text1.value)在form2表单的init事件中添加代码:thisform.grid1.recordsource=‘tabfwinfo‘在form2的“退出房屋信息列表”按钮的click事件中添加以下代码:thisform.visible=.f. &&隐藏表单在form3表单的init事件中添加代码:thisform.grid1.recordsource=‘‘在form3表单的load事件中添加代码:public bzcy在form3的“确定保存业主信息”按钮的click事件中添加以下代码:*获得输入信息yzdh=alltrim(thisform.text5.value)yzname=alltrim(thisform.text6.value)sex=alltrim(thisform.combo1.displayvalue)lxdz=alltrim(thisform.text11.value)sj=alltrim(thisform.text7.value)tel=alltrim(thisform.text9.value)workdw=alltrim(thisform.text14.value)dwtel=alltrim(thisform.text13.value)zjname=alltrim(thisform.combo3.displayvalue)zjnumber=alltrim(thisform.text12.value)sfjz=alltrim(thisform.combo2.displayvalue)gfhtno=alltrim(thisform.text10.value)glxysno=alltrim(thisform.text8.value)fwno=alltrim(thisform.text4.value)xqname=alltrim(thisform.text1.value)dlname=alltrim(thisform.text2.value)fjno=alltrim(thisform.text3.value)if sfjz=‘已进住‘ fwzt=‘入住‘else fwzt=‘签约‘endif*自动编号select tabrkinfoif empty(人口编号) rknumber=alltrim(‘RK00001‘)else select max(人口编号) from tabrkinfo into array a &&查找表tabrkinfo中最大的人口编号存入数组a中 cend=val(substr(a(1),3))+1 rknumber=alltrim(‘RK‘+padl(alltrim(str(cend,5)),5,‘0‘))endifif empty(yzname) or empty(gfhtno) or empty(glxysno) or empty(zjnumber) or empty(zjname) or empty(tel) messagebox(‘请将信息添全!‘,48,‘操作失败‘)else select tabyzinfo locate for 业主代号=yzdh &&顺序查询 if !found() insert into tabyzinfo values(yzdh,yzname,sex,lxdz,sj,tel,workdw,dwtel,zjname,zjnumber,; date1,date3,date2,date4,sfjz,gfhtno,glxysno,fwno,xqname,dlname,fjno) &&追加新记录 update wuyemanage!tabfwinfo set 房主代号=yzdh,房主姓名=yzname,是否空闲=.f.,; 房屋状态=fwzt where 房间编号==fwno &&更新数据表 insert into tabrkinfo values(rknumber,yzname,sex,ctod(‘‘),‘1‘,‘‘,‘户主‘,‘‘,‘‘,‘‘,workdw,‘‘,; ‘‘,‘‘,‘‘,dwtel,sj,tel,lxdz,xqname,dlname,fjno,zjnumber,‘‘,‘‘,fwno,‘‘) messagebox(‘数据保存完毕!‘,48,‘业主信息登记‘) thisform.parent.form1.grid1.column1.text1.click &&执行Text1的Click事件 thisform.visible=.f. &&隐藏表单 else update wuyemanage!tabyzinfo set 业主姓名=yzname,性别=sex,联系地址=lxdz,手机=sj,电话=tel,; 工作单位=workdw,单位电话=dwtel,证件号=zjnumber,签约日期=date1,进住日期=date3,; 进住起始日期=date2,进住截止日期=date4,是否进住=sfjz,购房合同书编号=gfhtno,; 管理协议书编号=glxysno,购入房编号=fwno,小区名称=xqname,大楼名称=dlname,; 房间号码=fjno where 业主代号==yzdh &&更新数据表 update wuyemanage!tabfwinfo set 房主代号=yzdh,房主姓名=yzname,是否空闲=.f.,; 房屋状态=fwzt where 房间编号==fwno update wuyemanage!tabrkinfo set 姓名=yzname,性别=sex,工作单位=workdw,单位电话=dwtel,; 手机=sj,传呼=tel,家庭住址=lxdz,身份证号=zjnumber where 房间编号==fwno thisform.parent.form1.grid1.column1.text1.click endifendif在form3表单的“添加成员信息”按钮的click事件中添加代码为:pfjno=alltrim(thisform.text3.value)pfjnumber=alltrim(thisform.text4.value)select *;from wuyemanage!tabrkinfo;where 房间编号==pfjnumber;order by 房间编号;into cursor lincyif reccount()=0 messagebox(‘请添加业主信息!‘,48,‘业主信息登记‘)else thisform.parent.form4.text3.value=alltrim(str(reccount()+1)) thisform.parent.form4.visible=.t. store ‘‘ to thisform.parent.form4.text1.value,thisform.parent.form4.text2.value,; thisform.parent.form4.text4.value,thisform.parent.form4.text5.value,; thisform.parent.form4.text6.value,thisform.parent.form4.text7.value,; thisform.parent.form4.text8.value,thisform.parent.form4.text9.value,; thisform.parent.form4.text10.value,thisform.parent.form4.text11.value,; thisform.parent.form4.text12.value,thisform.parent.form4.combo1.value,; thisform.parent.form4.combo2.value,thisform.parent.form4.combo3.value,; thisform.parent.form4.combo4.value,thisform.parent.form4.combo5.value,; thisform.parent.form4.combo6.value,thisform.parent.form4.combo7.value,; thisform.parent.form4.combo8.value,thisform.parent.form4.edit1.value thisform.parent.form4.text13.value={//} bzcy=.t.endifthisform.parent.form1.commandgroup1.command2.click &&执行Command2的Click事件在form3表单的“编辑成员信息”按钮的click事件中添加代码为:public pxq,pdl,pfjno,pfjnumberpxq=alltrim(thisform.text1.value)pdl=alltrim(thisform.text2.value)pfjno=alltrim(thisform.text3.value) &&定义全局变量pfjnumber=alltrim(thisform.text4.value)cvalue=alltrim(thisform.textg.value)if !empty(cvalue) thisform.parent.form4.visible=.t. cynumber=alltrim(thisform.textg.value) select *; from wuyemanage!tabrkinfo; where 人口编号==cynumber; into cursor lcyinfo thisform.parent.form4.text1.value=lcyinfo.姓名 thisform.parent.form4.text2.value=lcyinfo.职务 thisform.parent.form4.text3.value=lcyinfo.成员代号 thisform.parent.form4.text4.value=lcyinfo.身份证号 thisform.parent.form4.text5.value=lcyinfo.传呼 thisform.parent.form4.text6.value=lcyinfo.单位电话 thisform.parent.form4.text7.value=lcyinfo.家庭电话 thisform.parent.form4.text8.value=lcyinfo.暂住证号 thisform.parent.form4.text9.value=lcyinfo.手机 thisform.parent.form4.text10.value=lcyinfo.家庭住址 thisform.parent.form4.text11.value=lcyinfo.户口所在地 thisform.parent.form4.text12.value=lcyinfo.工作单位 thisform.parent.form4.text13.value=lcyinfo.出生日期 thisform.parent.form4.combo1.value=lcyinfo.性别 thisform.parent.form4.combo2.value=lcyinfo.籍贯 thisform.parent.form4.combo3.value=lcyinfo.婚姻状况 thisform.parent.form4.combo4.value=lcyinfo.职业 thisform.parent.form4.combo5.value=lcyinfo.文化程度 thisform.parent.form4.combo6.value=lcyinfo.职称 thisform.parent.form4.combo7.value=lcyinfo.与户主关系 thisform.parent.form4.combo8.value=lcyinfo.国籍 thisform.parent.form4.edit1.value=lcyinfo.备注 thisform.parent.form4.text1.setfocus &&Text1获得焦点 bzcy=.f.else messagebox(‘请选择成员名称!‘,48,‘家庭成员信息‘)endif在form3表单的“删除成员信息”按钮的click事件中添加代码为:rknumber=alltrim(thisform.textg.value)cmessagetitle=‘成员信息‘cmessagetext=‘确定要删除吗?‘ndialogtype=4+32nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle)if nAnswer=6 select tabrkinfo use use database/tabrkinfo exclusive &&以独占方式打开数据表 dele from tabrkinfo where 人口编号==rknumber &&逻辑删除记录 dele from tabyzinfo where empty(人口编号) pack &&物理删除 messagebox(‘删除完毕‘,48,‘操作成功!‘) use database abrkinfo thisform.parent.form1.commandgroup1.command2.click &&执行Command2的单击事件 thisform.textg.value=‘‘ thisform.refreshendif在form3表单的“退出业主登记”按钮的click事件中添加代码为:thisform.visible=.f. &&隐藏表单在表单form3的 date1控件的init事件中添加代码为:public date1y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date1=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date1控件的change事件中添加代码为:*** ActiveX 控件事件 ***y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date1=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date2控件的change事件中添加代码为:*** ActiveX 控件事件 ***y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date2=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date2控件的init事件中添加代码为:public date2y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date2=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date3控件的change事件中添加代码为:y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date3=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date3控件的init事件中添加代码为:public date3y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date3=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date4控件的change事件中添加代码为:y=alltrim(str(this.year))m=alltrim(str(this.month))d=alltrim(str(this.day))date4=ctod(m+‘/‘+d+‘/‘+y)在表单form3的 date4控件的init事件中添加代码为:y=alltrim(str(thisform.date4.year))m=alltrim(str(thisform.date4.month))d=alltrim(str(thisform.date4.day))date4=ctod(m+‘/‘+d+‘/‘+y)在form4表单的“保存并退出”按钮的click事件中添加代码为:set exact on &&设置字符精确比较*自动编号select tabrkinfoif empty(人口编号) rknumber=alltrim(‘RK00001‘)else select max(人口编号) from tabrkinfo into array a &&查找表中最大的人口编号存入数组 cend=val(substr(a(1),3))+1 rknumber=alltrim(‘RK‘+padl(alltrim(str(cend,5)),5,‘0‘))endif*获得输入信息cname=alltrim(thisform.text1.value)zw=alltrim(thisform.text2.value)cyno=alltrim(thisform.text3.value)sfzno=alltrim(thisform.text4.value)ch=alltrim(thisform.text5.value)dwtel=alltrim(thisform.text6.value)jttel=alltrim(thisform.text7.value)cmemo=alltrim(thisform.edit1.value)zzzno=alltrim(thisform.text8.value)sj=alltrim(thisform.text9.value)area=alltrim(thisform.text10.value)hkszd=alltrim(thisform.text11.value)workdw=alltrim(thisform.text12.value)birthday=thisform.text13.valuesex=alltrim(thisform.combo1.displayvalue)jg=alltrim(thisform.combo2.displayvalue)hyzk=alltrim(thisform.combo3.displayvalue)zy=alltrim(thisform.combo4.displayvalue)whcd=alltrim(thisform.combo5.displayvalue)zc=alltrim(thisform.combo6.displayvalue)yhzgx=alltrim(thisform.combo7.displayvalue)gj=alltrim(thisform.combo8.displayvalue)if empty(cname) or empty(sex) or empty(yhzgx) or empty(area) or empty(hkszd) messagebox(‘请将信息填完整!‘,48,‘操作失败‘)else if bzcy=.t. insert into tabrkinfo values(rknumber,cname,sex,birthday,cyno,whcd,yhzgx,jg,gj,; hyzk,workdw,zy,zw,zc,jttel,dwtel,sj,ch,area,pxq,pdl,pfjno,sfzno,hkszd,zzzno,; pfjnumber,cmemo) &&追加新记录 thisform.parent.form1.commandgroup1.command2.click else cmessagetitle=‘家庭成员信息‘ cmessagetext=‘信息已修改,确定要保存吗?‘ ndialogtype=4+32 nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle) do case case nAnswer=6 update wuyemanage!tabrkinfo set 姓名=cname,性别=sex,出生日期=birthday,成员代号=cyno,; 文化程度=whcd,与户主关系=yhzgx,籍贯=jg,国籍=gj,婚姻状况=hyzk,工作单位=workdw,职业=zy,; 职务=zw,职称=zc,家庭电话=jttel,单位电话=dwtel,手机=sj,传呼=ch,家庭住址=area,小区名称=pxq,; 大楼名称=pdl,房间号=pfjno,身份证号=sfzno,户口所在地=hkszd,暂住证号=zzzno,房间编号=pfjnumber,; 备注=cmemo where 人口编号==alltrim(thisform.parent.form3.textg.value) &&更新数据表 messagebox(‘数据保存完毕!‘,48,‘操作成功!‘) endcase endif endif thisform.visible=.f. &&隐藏表单在form4表单的“放弃并退出”按钮的click事件中添加代码为:thisform.visible=.f. &&隐藏表单(2) 在项目管理器中新建表单集包含form1,form2,名称为“小区投诉登记”。在表单form1中添加15个label控件,9个text控件,1个edit控件,4个combo控件,2个commandgroup控件,1个command控件。在表单form2中添加1个command控件,1个grid控件。说明:其编法如以上(1)所示6.工程部设计(1)在项目管理器中新建表单集包含form1,form2,名称为“装修信息登记”。在表单form1中添加15个label控件,12个text控件, 2个commandgroup控件。在表单form2中添加1个command控件,1个grid控件。在表单form1的 load事件中添加代码为:public ll=.f.在表单form1的 init事件中添加代码为:thisform.text1.enabled=l &&设置控件是否有效thisform.text2.enabled=lthisform.text3.enabled=lthisform.text4.enabled=lthisform.text5.enabled=lthisform.text6.enabled=lthisform.text7.enabled=lthisform.text8.enabled=lthisform.text9.enabled=lthisform.text10.enabled=lthisform.text11.enabled=lthisform.text12.enabled=lthisform.combo1.enabled=lthisform.edit1.enabled=l在表单form1的 activate事件中添加代码为:thisform.text1.value=tabzxinfo.编号thisform.text2.value=tabzxinfo.申请人thisform.text3.value=tabzxinfo.客户thisform.text4.value=tabzxinfo.预算thisform.text5.value=tabzxinfo.装修押金thisform.text6.value=tabzxinfo.装修管理费thisform.text7.value=tabzxinfo.罚金thisform.text8.value=tabzxinfo.验收thisform.text9.value=tabzxinfo.申请日期thisform.text10.value=tabzxinfo.退押金时间thisform.text11.value=tabzxinfo.完工日期thisform.text12.value=tabzxinfo.经办人thisform.combo1.displayvalue=tabzxinfo.装修队thisform.edit1.value=tabzxinfo.装修内容thisform.refresh &&刷新表单在form1的“添加”按钮的click事件中添加以下代码:if alltrim(thisform.commandgroup1.command1.caption)=‘添加‘ thisform.commandgroup1.command1.caption=‘保存‘ &&赋值给Command1的标题文本 thisform.commandgroup1.command2.caption=‘取消‘ thisform.commandgroup1.command3.enabled=.f. thisform.commandgroup1.command4.enabled=.f. l=.t. thisform.init &&执行表单的Init事件 thisform.text1.enabled=.f.*自动编号 select tabzxinfo if empty(编号) zxno=alltrim(‘ZX00001‘) else select max(编号) from tabzxinfo into array a &&查找表中最大的编号存入数组 cend=val(substr(a(1),3))+1 zxno=alltrim(‘ZX‘+padl(alltrim(str(cend,5)),5,‘0‘)) endif thisform.text1.value=zxno store 0 to thisform.text4.value,thisform.text5.value,; thisform.text7.value,thisform.text6.value store ‘‘ to thisform.text3.value,thisform.text2.value,thisform.text12.value,; thisform.text8.value,thisform.combo1.value,thisform.edit1.value store {//} to thisform.text9.value,thisform.text10.value,thisform.text11.value thisform.combo1.setfocuselse thisform.commandgroup1.command1.caption=‘添加‘ thisform.commandgroup1.command2.capti

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧