⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form3.frm

📁 房产信息管理系统 VB+ACCESS 值得借鉴
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form3 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "修改房产信息"
   ClientHeight    =   3945
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6300
   Icon            =   "Form3.frx":0000
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   ScaleHeight     =   3945
   ScaleWidth      =   6300
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   1283
      TabIndex        =   4
      Top             =   3285
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Height          =   855
      Left            =   263
      TabIndex        =   12
      Top             =   285
      Width           =   5775
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   270
         Left            =   2303
         TabIndex        =   6
         TabStop         =   0   'False
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "房产编号"
         Height          =   180
         Left            =   1440
         TabIndex        =   13
         Top             =   360
         Width           =   720
      End
   End
   Begin VB.Frame Frame2 
      Height          =   1695
      Left            =   263
      TabIndex        =   7
      Top             =   1365
      Width           =   5775
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   3840
         TabIndex        =   1
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox Text4 
         Height          =   270
         Left            =   1080
         TabIndex        =   2
         Top             =   1080
         Width           =   1695
      End
      Begin VB.TextBox Text5 
         Height          =   270
         Left            =   3840
         TabIndex        =   3
         Top             =   1080
         Width           =   1695
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1080
         TabIndex        =   0
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "房产地址"
         Height          =   180
         Left            =   3000
         TabIndex        =   11
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "销售价格"
         Height          =   180
         Left            =   240
         TabIndex        =   10
         Top             =   1080
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "房面积"
         Height          =   180
         Left            =   3000
         TabIndex        =   9
         Top             =   1080
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "房产户型"
         Height          =   180
         Left            =   240
         TabIndex        =   8
         Top             =   360
         Width           =   720
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   3563
      TabIndex        =   5
      Top             =   3285
      Width           =   1455
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Sub Command1_Click()
On Error GoTo error
Check
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Command2_Click()
On Error GoTo error
Unload Me
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Form_Load()
On Error GoTo error
Form(3) = True
Text1.Text = Form1.ListView1.SelectedItem
Text2.Text = Form1.ListView1.SelectedItem.SubItems(1)
Text3.Text = Form1.ListView1.SelectedItem.SubItems(2)
Text4.Text = Form1.ListView1.SelectedItem.SubItems(3)
Text5.Text = Form1.ListView1.SelectedItem.SubItems(4)
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error GoTo error
Form(3) = False
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text2_GotFocus()
On Error GoTo error
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
On Error GoTo error
If KeyAscii = vbKeyReturn Then
Command1_Click
End If
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text3_GotFocus()
On Error GoTo error
Text3.SelStart = 0
Text3.SelLength = Len(Text3.Text)
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
On Error GoTo error
If KeyAscii = vbKeyReturn Then
Command1_Click
End If
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text4_GotFocus()
On Error GoTo error
Text4.SelStart = 0
Text4.SelLength = Len(Text4.Text)
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
On Error GoTo error
If KeyAscii = vbKeyReturn Then
Command1_Click
End If
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text5_GotFocus()
On Error GoTo error
Text5.SelStart = 0
Text5.SelLength = Len(Text5.Text)
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Public Sub EditHouse()
On Error GoTo error
Dim sql As String
'连接数据库
sql = "UPDATE House " & "SET Kind='" & Trim(Text2.Text) & "',Address='" & Text3.Text & "',Price=" & Text4.Text & ",Area=" & Text5.Text & " WHERE ID=" & Text1.Text & ""
conn.Execute sql
'重新显示
Form1.House_Show
'提示
MsgBox "修改成功!", vbInformation
'设置焦点
Command2.SetFocus
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub
Public Sub Check()
On Error GoTo error
If Trim(Text2.Text) = "" Then
MsgBox "房产户型为空!", vbExclamation
Text2.SetFocus
Exit Sub
End If
If Trim(Text3.Text) = "" Then
MsgBox "房产地址为空!", vbExclamation
Text3.SetFocus
Exit Sub
End If
If Trim(Text4.Text) = "" Then
MsgBox "销售价格为空!", vbExclamation
Text4.SetFocus
Exit Sub
End If
If IsNumeric(Text4.Text) = False Then
MsgBox "销售价格不是数字!", vbExclamation
Text4.SetFocus
Exit Sub
End If
If Text4.Text < 0 Then
MsgBox "销售价格为负数!", vbExclamation
Text4.SetFocus
Exit Sub
End If
If Trim(Text5.Text) = "" Then
MsgBox "房面积为空!", vbExclamation
Text5.SetFocus
Exit Sub
End If
If IsNumeric(Text5.Text) = False Then
MsgBox "房面积不是数字!", vbExclamation
Text5.SetFocus
Exit Sub
End If
If Text5.Text < 0 Then
MsgBox "房面积为负数!", vbExclamation
Text5.SetFocus
Exit Sub
End If
EditHouse
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
On Error GoTo error
If KeyAscii = vbKeyReturn Then
Command1_Click
End If
Exit Sub
error:
MsgBox Err.Description, vbExclamation
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -