📄 frm_wyinfo.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Frm_wyinfo
Caption = "物业信息设定"
ClientHeight = 4305
ClientLeft = 1920
ClientTop = 2235
ClientWidth = 7155
Icon = "Frm_wyinfo.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4305
ScaleWidth = 7155
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton CmdAdd
Caption = "保 存"
Height = 360
Left = 1155
TabIndex = 25
Top = 3885
Width = 990
End
Begin VB.CommandButton CmdCancel
Caption = "取 消"
Height = 360
Left = 2730
TabIndex = 24
Top = 3870
Width = 990
End
Begin VB.CommandButton CmdExit
Caption = "返 回"
Height = 360
Left = 4410
TabIndex = 23
Top = 3870
Width = 990
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 315
Top = 4305
Visible = 0 'False
Width = 1560
_ExtentX = 2752
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Microsoft Visual Studio\VB98\db_wygl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Microsoft Visual Studio\VB98\db_wygl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from tab_xqinfo"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "物业信息栏"
Height = 3600
Left = 105
TabIndex = 0
Top = 150
Width = 6930
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 300
Index = 0
Left = 1095
MaxLength = 50
TabIndex = 18
Top = 300
Width = 5610
End
Begin VB.TextBox Text1
Height = 300
Index = 3
Left = 1095
MaxLength = 50
TabIndex = 17
Top = 705
Width = 945
End
Begin VB.TextBox Text1
Height = 300
Index = 4
Left = 2940
MaxLength = 50
TabIndex = 16
Top = 705
Width = 735
End
Begin VB.TextBox Text1
Height = 300
Index = 5
Left = 4515
MaxLength = 50
TabIndex = 15
Top = 705
Width = 630
End
Begin VB.TextBox Text1
Height = 300
Index = 1
Left = 1095
MaxLength = 50
TabIndex = 14
Top = 1140
Width = 1920
End
Begin VB.TextBox Text1
Height = 1035
Index = 11
Left = 1110
MaxLength = 50
ScrollBars = 2 'Vertical
TabIndex = 12
Top = 2430
Width = 5610
End
Begin VB.TextBox Text1
Height = 300
Index = 10
Left = 1095
MaxLength = 50
TabIndex = 11
Top = 2010
Width = 5610
End
Begin VB.TextBox Text1
Height = 300
Index = 9
Left = 6075
MaxLength = 50
TabIndex = 10
Top = 720
Width = 630
End
Begin VB.TextBox Text1
Height = 300
Index = 8
Left = 4290
MaxLength = 50
TabIndex = 9
Top = 1530
Width = 2415
End
Begin VB.TextBox Text1
Height = 300
Index = 7
Left = 4245
MaxLength = 50
TabIndex = 2
Top = 1110
Width = 2415
End
Begin VB.TextBox Text1
Height = 300
Index = 6
Left = 1050
MaxLength = 50
TabIndex = 1
Top = 1530
Width = 2625
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "住户数"
Height = 180
Index = 5
Left = 3930
TabIndex = 22
Top = 765
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "别墅个数"
Height = 180
Index = 4
Left = 2190
TabIndex = 21
Top = 765
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "经理:"
Height = 180
Index = 3
Left = 165
TabIndex = 20
Top = 765
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "物业名称"
Height = 180
Index = 0
Left = 165
TabIndex = 19
Top = 360
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "联系电话"
Height = 180
Index = 1
Left = 165
TabIndex = 13
Top = 1200
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "地址"
Height = 180
Index = 10
Left = 165
TabIndex = 8
Top = 2070
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "简介"
Height = 180
Index = 11
Left = 165
TabIndex = 7
Top = 2835
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "占地面积"
Height = 180
Index = 9
Left = 5205
TabIndex = 6
Top = 780
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "传真号码"
Height = 180
Index = 7
Left = 3330
TabIndex = 5
Top = 1170
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "公司主页"
Height = 180
Index = 6
Left = 105
TabIndex = 4
Top = 1590
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "E-MAIL"
Height = 180
Index = 8
Left = 3675
TabIndex = 3
Top = 1575
Width = 540
End
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = -240
Top = 2415
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "Frm_wyinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub view_data() '声明一个显示reads表中数据的过程
With Adodc1.Recordset
For i = 0 To 11
If .Fields(i) <> "" Then
Text1(i).Text = .Fields(i)
Else
Text1(i).Text = ""
End If
If .Fields("图片") <> "" Then
Lbllj.Caption = .Fields("图片")
If Dir(.Fields("图片")) <> "" Then
Picture1.Picture = LoadPicture(.Fields("图片"))
Else
MsgBox "此图片路径错误,请更改!"
Picture1.Picture = LoadPicture("")
End If
Else
Lbllj.Caption = ""
Picture1.Picture = LoadPicture("")
End If
Next i
End With
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker2.SetFocus
End Sub
Private Sub DTPicker2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then CmdSave.SetFocus
End Sub
Private Sub CmdAdd_Click()
For i = 1 To 11
Text1(i).Text = ""
Next i
adors.Open "select * from tab_xqinfo order by val(小区编号)", cn, adOpenKeyset, adLockOptimistic
With adors
If .RecordCount > 0 Then
If .EOF = False Then .MoveLast
Text1(0).Text = Val(.Fields("小区编号")) + 1
Else
Text1(0).Text = "1"
End If
End With
adors.Close
Text1(1).SetFocus
End Sub
Private Sub CmdAddPicture_Click()
'添加图片
With CommonDialog1
.DialogTitle = "选择要追加的图片"
.Filter = "JPG图片|*.JPG"
.ShowOpen '打开对话框
Picture1.Picture = LoadPicture(.FileName)
Lbllj.Caption = .FileName
End With
End Sub
Private Sub CmdCancel_Click()
For i = 1 To 11
Text1(i).Text = ""
Next i
Picture1.Picture = LoadPicture("")
Lbllj.Caption = ""
End Sub
Private Sub CmdClearPicture_Click()
Picture1.Picture = LoadPicture("")
End Sub
Private Sub CmdDelete_Click()
If Adodc1.Recordset.RecordCount > 0 Then
a = MsgBox("您确实要删除这条数据吗?", vbYesNo)
If a = vbYes Then
'删除当前记录
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
End If
End Sub
Private Sub CmdMD_Click(Index As Integer)
Select Case Index
Case Is = 0 '移到第一条记录
If Not Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
Case Is = 1 '移到上一条记录
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.BOF = False Then Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF = True Then Adodc1.Recordset.MoveFirst
End If
Case Is = 2 '移到下一条记录
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveLast
End If
Case Is = 3 '移到最后一条记录
If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveLast
End Select
Call view_data '调用过程
End Sub
Private Sub CmdSave_Click()
adors.Open "select * from tab_xqinfo where 小区编号='" & Text1(0) & "'", cn, adOpenKeyset, adLockOptimistic
If adors.RecordCount > 0 Then
Set adors = cn.Execute("update tab_xqinfo set 小区名称 ='" & Text1(1) & "',小区说明 ='" & Text1(2) & "',负责人 ='" & Text1(3) & "',楼栋数 ='" & Text1(4) & "',总户数 ='" & Text1(5) & "',建筑面积 ='" & Text1(6) & "',居住面积 ='" & Text1(7) & "',绿化面积 ='" & Text1(8) & "',占地面积 ='" & Text1(9) & "',地址 ='" & Text1(10) & "',备注 ='" & Text1(11) & "',图片 ='" & Lbllj.Caption & "',交工日期='" & DTPicker1 & "',竣工日期='" & DTPicker2 & "'where 小区编号='" & Text1(0) & "'")
MsgBox "数据保存成功", 32, "管理信息系统"
Adodc1.Refresh
CmdCancel_Click
Else
adors.AddNew
For i = 0 To 11
adors.Fields(i) = Text1(i).Text
Next i
adors.Fields(12) = Lbllj.Caption
adors.Fields(13) = DTPicker1.Value
adors.Fields(14) = DTPicker2.Value
adors.Update
Adodc1.Refresh
CmdCancel_Click
End If
adors.Close
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Form_Load()
Adodc1.RecordSource = "select * from tab_xqinfo order by 小区编号"
Adodc1.Refresh
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If Index < 11 And KeyCode = vbKeyReturn Then
SendKeys "{Home}+{End}"
Text1(Index + 1).SetFocus
End If
If Index = 11 And KeyCode = vbKeyReturn Then DTPicker1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -