论文无忧网提供:计算机毕业论文范文|计算机毕业设计|计算机毕业论文
栏目导航 ASP Java Web .NET VB6.0 JAVA VC VF DELPHI PB 计算机网络 计算机科学与技术 PHP 安卓APP 其他 C# 代写论文
当前位置: > 计算机 > VB6.0 >

B(VB)售楼管理系统(第一稿)

Private Subcmdadd_Click()

 On Error GoTo adderror

http://www.paper51.com

    If cmdAdd.Caption = "保  存" Then http://www.paper51.com

        '下面对输入的有效性进行验证

paper51.com

        IfTrim(txtHuxingnum.Text) = "" Then

http://www.paper51.com

          MsgBox "户型编号不能为空!", vbOKOnly + vbExclamation, "" copyright paper51.com

          txtHuxingnum.SetFocus

paper51.com

          Exit Sub

http://www.paper51.com

        EndIf copyright paper51.com

        IfTrim(txtFangxing.Text) = "" Then 内容来自www.paper51.com

          MsgBox "请选择房型!", vbOKOnly + vbExclamation, " "

内容来自论文无忧网 www.paper51.com

          Combo1.SetFocus 内容来自论文无忧网 www.paper51.com

          Exit Sub

http://www.paper51.com

        EndIf

内容来自www.paper51.com

        IfTrim(txtJianzhumianji.Text) = "" Then 内容来自www.paper51.com

          MsgBox "建筑面积不能为空!", vbOKOnly + vbExclamation, " "

copyright paper51.com

          txtJianzhumianji.SetFocus paper51.com

          Exit Sub

http://www.paper51.com

        EndIf

copyright paper51.com

        IfTrim(txtTaomianji.Text) = "" Then

内容来自论文无忧网 www.paper51.com

          MsgBox "套内面积不能为空!", vbOKOnly + vbExclamation, " "

paper51.com

          txtTaomianji.SetFocus paper51.com

          Exit Sub paper51.com

        EndIf

http://www.paper51.com

        IfNot IsNumeric(txtJianzhumianji.Text) Then '面积必须是数值

paper51.com

             MsgBox "建筑面积请输入数字!", vbOKOnly +vbExclamation, "" 内容来自论文无忧网 www.paper51.com

             txtJianzhumianji.SetFocus

paper51.com

             Exit Sub

内容来自www.paper51.com

        EndIf paper51.com

        IfNot IsNumeric(txtTaomianji.Text) Then 内容来自论文无忧网 www.paper51.com

             MsgBox "套内面积请输入数字!", vbOKOnly + vbExclamation, "" http://www.paper51.com

             txtTaomianji.SetFocus

copyright paper51.com

             Exit Sub

http://www.paper51.com

        EndIf http://www.paper51.com

       rs_huxing.MoveFirst             '输入合法,开始插入

paper51.com

        Dimi As Integer

copyright paper51.com

        Fori = 0 To rs_huxing.RecordCount - 1  '逐条检查户型编号是否已经存在

内容来自论文无忧网 www.paper51.com

           If Trim(rs_huxing.Fields(0)) = Trim(txtHuxingnum.Text) Then

http://www.paper51.com

              MsgBox "户型编号重复!", vbOKOnly + vbExclamation, " "

copyright paper51.com

              txtHuxingnum.SetFocus 内容来自www.paper51.com

              Exit Sub

内容来自论文无忧网 www.paper51.com

           End If 内容来自论文无忧网 www.paper51.com

           rs_huxing.MoveNext copyright paper51.com

        Nexti

http://www.paper51.com

       rs_huxing.MoveLast             '户型编号不存在,在最后插入新纪录 paper51.com

       rs_huxing.AddNew

copyright paper51.com

       rs_huxing.Fields(0) = Trim(txtHuxingnum.Text)      '逐字段插入

http://www.paper51.com

       rs_huxing.Fields(1) = CSng(txtJianzhumianji.Text)  '数值转换为字符串

内容来自www.paper51.com

       rs_huxing.Fields(2) = CSng(txtTaomianji.Text)

copyright paper51.com

       rs_huxing.Fields(3) = Trim(txtFangxing.Text)

http://www.paper51.com

       rs_huxing.Fields(4) = Trim(txtJianjie.Text)

内容来自www.paper51.com

       rs_huxing.Fields(5) = Trim(txtHuxingnum.Text)

paper51.com

       rs_huxing.Update                               '将插入的记录保存

paper51.com

       MsgBox "添加成功!", vbOKOnly + vbExclamation, ""

内容来自www.paper51.com

        WithgrdHuxing                            '将表格最后一行数据更新

内容来自www.paper51.com

            .Rows = rs_huxing.RecordCount + 1

http://www.paper51.com

            .Row = grdHuxing.Rows - 1

内容来自论文无忧网 www.paper51.com

            .Col = 0

copyright paper51.com

            .Text = Trim(txtHuxingnum.Text) http://www.paper51.com

            .Col = 1

http://www.paper51.com

            .Text = Trim(txtJianzhumianji.Text)

copyright paper51.com

            .Col = 2

paper51.com

            .Text = Trim(txtTaomianji.Text)

copyright paper51.com

            .Col = 3 copyright paper51.com

            .Text = Trim(txtFangxing.Text) 内容来自www.paper51.com

            .Col = 4 paper51.com

            .Text = Trim(txtFangxing.Text) http://www.paper51.com

            .Col = 5 http://www.paper51.com

            .Text = Trim(txtJianjie.Text)

paper51.com

        EndWith

copyright paper51.com

          cmdAdd.Caption = "增  加"        '成功保存后标题变为“增  加”

内容来自论文无忧网 www.paper51.com

    Else                                    '按钮标题为"增  加"时 copyright paper51.com

       txtHuxingnum.Text = ""             '各个字段为空

内容来自论文无忧网 www.paper51.com

       txtJianzhumianji.Text = ""

copyright paper51.com

       txtTaomianji.Text = ""

内容来自论文无忧网 www.paper51.com

       txtJianjie.Text = ""

内容来自论文无忧网 www.paper51.com

       cmdModify.Enabled = False          '新增记录时,不能修改和删除记录 内容来自www.paper51.com

       cmdDel.Enabled = False

内容来自论文无忧网 www.paper51.com

       cmdAdd.Caption = "保  存"         '按钮标题变为“保  存” 内容来自论文无忧网 www.paper51.com

    End If

paper51.com

    Exit Sub 内容来自论文无忧网 www.paper51.com

adderror:

paper51.com

------分隔线----------------------------
联系方式