77范文网 - 专业文章范例文档资料分享平台

实验2《软件项目的设计》实验报告 - 图文(7)

来源:网络收集 时间:2019-08-28 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

KeyAscii = 0 End If End Sub

Private Sub txtOpID_KeyPress(KeyAscii As Integer)

If Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9 _ Or KeyAscii = vbKeyBack) Then KeyAscii = 0 End If End Sub

学生登记界面如图5.4所示。

图5.4学生信息登记界面

代码如下:

Private Sub cmdAdd_Click() dgdVip.Enabled = False cmdRefresh.Enabled = False txtVipID.Enabled = True

If cmdAdd.Caption = \添加(&A)\ cmdAdd.Caption = \确定\ txtVipID.SetFocus

SetTextEmpty ' Reference a founction to set empty cmdDel.Enabled = False

28

cmdModify.Enabled = False cmdRefresh.Enabled = False Else

'To Progress option Dim vipsex As String

If VipMale.Value = True Then vipsex = \男\

ElseIf VipFemale.Value = True Then vipsex = \女\ Else

vipsex = \ End If

If txtVipName.Text = \

MsgBox \ txtVipName.SetFocus Exit Sub

ElseIf txtVipID.Text = \

MsgBox \ txtVipID.SetFocus Exit Sub Else

With objRs

checkAddNew = True

.Filter = \ If .RecordCount > 0 Then

MsgBox \ txtVipID.Text = \ txtVipID.SetFocus .Filter = \ cmdRefresh.Value = True checkAddNew = False cmdDel.Enabled = True cmdModify.Enabled = True cmdAdd.Caption = \添加(&A)\ txtVipID.Enabled = False cmdRefresh.Enabled = True dgdVip.Enabled = True checkAddNew = False Exit Sub End If

checkAddNew = True .AddNew

29

.Fields(0).Value = Trim(txtVipID) .Fields(1).Value = Trim(txtVipName) .Fields(2) = vipsex

.Fields(3) = Trim(txtVipID_card.Text) .Fields(4) = Trim(txtVipPhone.Text) .Fields(5) = Trim(txtVipAddress.Text) .Fields(6) = Trim(txtVipAddTime.Text) .Fields(7) = Trim(txtVipEndTime.Text) .Update

MsgBox \ .Filter = \ cmdRefresh.Value = True End With

checkAddNew = False cmdDel.Enabled = True cmdModify.Enabled = True cmdAdd.Caption = \添加(&A)\ txtVipID.Enabled = False cmdRefresh.Enabled = True dgdVip.Enabled = True End If End If End Sub

Private Sub cmdClose_Click() Unload Me End Sub

Private Sub cmdDel_Click()

If Empty_Check = True Then Exit Sub 'Reference function to check if your database is empty CheckConnect 'To break objrs if it is opened If ConnectToServer = True Then

Set objRs = New ADODB.Recordset

StrSql = \* from tBorrow where cVipID ='\& Trim(txtVipID.Text) & \cReturnTime='' \

GetData StrSql 'Reference function to get data If objRs.RecordCount > 0 Then

MsgBox \ CheckConnect 'To break objrs if it is opened If ConnectToServer = True Then

Set objRs = New ADODB.Recordset StrSql = \

GetData StrSql 'Reference fuction to get data Set dgdVip.DataSource = objRs

30

cmdRefresh.Value = True 'Exectue refresh in order to list data when form load ColNamechange 'Reference fuction to change columns name to chinese End If Else

If MsgBox(txtVipName & \'s data will delete are you sure to continue ?\vbYesNo + vbInformation) = vbYes Then

StrSql = \ objCon.Execute StrSql

CheckConnect 'To break objrs if it is opened If ConnectToServer = True Then

Set objRs = New ADODB.Recordset StrSql = \

GetData StrSql 'Reference function in order to get data Set dgdVip.DataSource = objRs

cmdRefresh.Value = True 'Exectue refresh in order to list data when form load ColNamechange 'Reference fuction to change columns name to chinese End If End If

CheckConnect 'To break objrs if it is opened If ConnectToServer = True Then

Set objRs = New ADODB.Recordset StrSql = \

GetData StrSql 'Reference fuction to get data Set dgdVip.DataSource = objRs

cmdRefresh.Value = True 'Exectue refresh in order to list data when form load ColNamechange 'Reference fuction to change columns name to chinese End If End If End If End Sub

Private Sub cmdModify_Click()

If Empty_Check = True Then Exit Sub 'Reference function to check is your database is empty If Trim(txtVipID.Text) <> Trim(objRs.Fields(0).Value) Then Exit Sub 'To check vipID If cmdModify.Caption = \修改(&M)\ cmdModify.Caption = \确定\ cmdDel.Enabled = False cmdAdd.Enabled = False cmdRefresh.Enabled = False Else

If MsgBox(\you sure to modify this record \vbYesNo + vbInformation) = vbYes Then

With objRs

31

If Not .EOF And .RecordCount > 0 Then .Fields(0).Value = Trim(txtVipID.Text) .Fields(1).Value = Trim(txtVipName.Text) ' .Fields(2) = vipsex

.Fields(3) = Trim(txtVipID_card.Text) .Fields(4) = Trim(txtVipPhone.Text) .Fields(5) = Trim(txtVipAddress.Text) .Fields(6) = Trim(txtVipAddTime.Text) .Fields(7) = Trim(txtVipEndTime.Text) .Update End If End With

cmdModify.Caption = \修改(&M)\ cmdDel.Enabled = True cmdAdd.Enabled = True cmdRefresh.Enabled = True End If End If End Sub

Private Sub cmdRefresh_Click()

RefreshVip 'Reference refreshvip function to refresh End Sub

Private Sub dgdVip_RowColChange(LastRow As Variant, ByVal LastCol As Integer) If checkAddNew = True Then Exit Sub cmdRefresh.Value = True End Sub

Private Sub Form_Activate()

FormMiddle frmVipReg 'Reference function to make form in MDIForm'mddile If ConnectToServer = True Then

Set objRs = New ADODB.Recordset StrSql = \

GetData StrSql 'Reference function in order to get data Set dgdVip.DataSource = objRs

cmdRefresh.Value = True 'Exectue refresh in order to list data when form load ColNamechange 'Reference fuction to change columns name to chinese End If End Sub

图书信息登记界面如图5.5所示。

32

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库实验2《软件项目的设计》实验报告 - 图文(7)在线全文阅读。

实验2《软件项目的设计》实验报告 - 图文(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/688432.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: