📄 frmbaseinfo.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmBaseInfo
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 3 'Fixed Dialog
Caption = "气站信息维护"
ClientHeight = 7020
ClientLeft = 45
ClientTop = 435
ClientWidth = 9510
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 7020
ScaleWidth = 9510
ShowInTaskbar = 0 'False
Begin VB.TextBox txt
Appearance = 0 'Flat
Height = 300
Index = 3
Left = 1050
TabIndex = 12
Top = 780
Width = 2175
End
Begin VB.TextBox txt
Appearance = 0 'Flat
Height = 300
Index = 4
Left = 4260
TabIndex = 11
Top = 780
Width = 2175
End
Begin MSComctlLib.ListView lstStation
Height = 5835
Left = 0
TabIndex = 8
Top = 1140
Width = 9465
_ExtentX = 16695
_ExtentY = 10292
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.TextBox txt
Appearance = 0 'Flat
Height = 300
Index = 2
Left = 1050
TabIndex = 6
Top = 420
Width = 5385
End
Begin VB.TextBox txt
Appearance = 0 'Flat
Height = 300
Index = 1
Left = 4260
TabIndex = 4
Top = 60
Width = 2175
End
Begin CSCommand.Command cmdOK
Height = 375
Left = 6570
TabIndex = 1
Top = 150
Width = 1335
_ExtentX = 2355
_ExtentY = 661
Icon = "frmBaseInfo.frx":0000
Caption = "确定(&S)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txt
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
Index = 0
Left = 1050
TabIndex = 0
Top = 60
Width = 2175
End
Begin CSCommand.Command cmdback
Height = 375
Left = 8010
TabIndex = 2
Top = 615
Width = 1335
_ExtentX = 2355
_ExtentY = 661
Icon = "frmBaseInfo.frx":059A
Caption = "返回(&B)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdPrint
Height = 375
Left = 6570
TabIndex = 9
Top = 615
Width = 1335
_ExtentX = 2355
_ExtentY = 661
Icon = "frmBaseInfo.frx":0B34
Caption = "打印(&P)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdQuery
Height = 375
Left = 8010
TabIndex = 10
Top = 150
Width = 1335
_ExtentX = 2355
_ExtentY = 661
Icon = "frmBaseInfo.frx":10CE
Caption = "查询(&Q)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联 系 人:"
Height = 180
Index = 5
Left = 150
TabIndex = 14
Top = 840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系电话:"
Height = 180
Index = 4
Left = 3390
TabIndex = 13
Top = 840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "气站地址:"
Height = 180
Index = 2
Left = 150
TabIndex = 7
Top = 480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "气站名称:"
Height = 180
Index = 1
Left = 3390
TabIndex = 5
Top = 120
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "气站编码:"
Height = 180
Index = 0
Left = 150
TabIndex = 3
Top = 120
Width = 900
End
End
Attribute VB_Name = "frmBaseInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdBack_Click()
'返回
tBackMain Me
End Sub
Private Sub cmdOK_Click()
Dim iIndex As Integer
On Error GoTo ErrInfo
For iIndex = 0 To 2
If txt(iIndex).Text = "" Then
MsgBox "错误的信息!或者基本信息为空!", vbInformation, "提示:"
txt(iIndex).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
Next
With uShareInfo
.strCode = txt(0).Text
.strName = txt(1).Text
.strShare = txt(2).Text
.strShare1 = txt(3).Text
.strType = txt(4).Text
End With
'添加数据
If tLPGStation(uShareInfo, iAdd_Update) = False Then
MsgBox "数据操作失败!请检查数据录入是否正确!", vbInformation, "提示:"
cmdOK.SetFocus
Exit Sub
End If
'添加成功以后,将标志清除为0
iAdd_Update = 0
MsgBox "数据操作成功!", vbInformation, "提示:"
For iIndex = 0 To txt.Count - 1
txt(iIndex).Text = ""
Next
'显示数据
getStationData ""
txt(0).Locked = False
txt(0).Text = tBigCode("tbCCStation", "StaCode")
txt(1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
ErrInfo:
MsgBox Err.Description, vbInformation, "提示:"
End Sub
Private Sub cmdQuery_Click()
On Error GoTo ErrInfo
'显示数据
getStationData Trim(txt(0).Text)
Exit Sub
ErrInfo:
MsgBox Err.Description, vbInformation, "提示:"
End Sub
Private Sub Form_Load()
'计算窗体显示位置
tFormSpace frmMain, Me, uWindows
iAdd_Update = 0
'显示表头
getStation
'显示数据
getStationData ""
End Sub
Private Sub lstStation_DblClick()
On Error Resume Next
iAdd_Update = 1
txt(0).Text = lstStation.SelectedItem.SubItems(1)
txt(1).Text = lstStation.SelectedItem.SubItems(2)
txt(2).Text = lstStation.SelectedItem.SubItems(5)
txt(3).Text = lstStation.SelectedItem.SubItems(3)
txt(4).Text = lstStation.SelectedItem.SubItems(4)
txt(0).Locked = True
txt(1).SetFocus
SendKeys "{Home}+{End}"
End Sub
Private Sub txt_GotFocus(Index As Integer)
txt(Index).BackColor = &HC0FFC0
txt(Index).ForeColor = vbRed
End Sub
Private Sub txt_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyDown
If Index = txt.Count - 1 Then Exit Sub
txt(Index + 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Case vbKeyUp
If Index = 0 Then Exit Sub
txt(Index - 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Case Else
Exit Sub
End Select
End Sub
Private Sub txt_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyReturn
Select Case Index
Case 0
If txt(Index).Text = "" Then
If MsgBox("系统将自动生成最大编码?", vbInformation + vbYesNo, "提示:") = vbYes Then
txt(Index).Text = tBigCode("tbCCStation", "StaCode")
txt(Index + 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Else
txt(Index).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
End If
If tWhileCode("tbCCStation", "StaCode", Format(Trim(txt(Index).Text), "0000")) = False Then
MsgBox "编码重复!请检查您的输入是否正确?", vbInformation, "提示:"
txt(Index).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Else
txt(Index).Text = Format(txt(Index).Text, "0000")
txt(Index + 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
Case 1
If txt(Index).Text = "" Then
txt(Index).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
If tWhileCode("tbCCStation", "StaName", Trim(txt(Index).Text)) = False Then
MsgBox "信息重复!请检查您的输入是否正确?", vbInformation, "提示:"
txt(Index).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Else
txt(Index + 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
Case 2
txt(Index + 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Case 3
txt(Index + 1).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
Case 4
cmdOK.SetFocus
End Select
Case Else
Exit Sub
End Select
End Sub
Private Sub txt_LostFocus(Index As Integer)
txt(Index).BackColor = vbWhite
txt(Index).ForeColor = vbBlack
End Sub
'显示表头
Private Sub getStation()
With lstStation
.ListItems.Clear
.FullRowSelect = True
.LabelEdit = lvwManual
.GridLines = True
.View = lvwReport
With .ColumnHeaders
.Clear
.Add , , "@", 0
.Add , , "气站编码", 1400
.Add , , "气站名称", 1800
.Add , , "联系人", 1400
.Add , , "联系电话", 1800
.Add , , "地 址", 2800
End With
End With
End Sub
'显示数据
Private Function getStationData(strInfo As String)
Dim rsTemp As New ADODB.Recordset
Dim iIndex As Integer
Dim strSQL As String
strSQL = " Where StaCode Like '" & strInfo & "%' Or StaName Like '" & strInfo & "%' Or StaAddress Like '" & strInfo & "%' Or Stalink_Man Like '" & strInfo & "%' Or Stalink_Tel Like '" & strInfo & "%' "
Set rsTemp = DBCN.Execute("Select StaCode,StaName,StaAddress,Stalink_Man,Stalink_Tel from TBCCStation " & strSQL & " Order By StaCode")
If rsTemp.EOF = False Then
iIndex = 1
lstStation.ListItems.Clear
Do Until rsTemp.EOF
lstStation.ListItems.Add iIndex, , iIndex
With lstStation.ListItems(iIndex)
.SubItems(1) = IIf(IsNull(rsTemp.Fields("StaCode")), "", rsTemp.Fields("StaCode"))
.SubItems(2) = IIf(IsNull(rsTemp.Fields("StaName")), "", rsTemp.Fields("StaName"))
.SubItems(3) = IIf(IsNull(rsTemp.Fields("Stalink_Man")), "", rsTemp.Fields("Stalink_Man"))
.SubItems(4) = IIf(IsNull(rsTemp.Fields("Stalink_Tel")), "", rsTemp.Fields("Stalink_Tel"))
.SubItems(5) = IIf(IsNull(rsTemp.Fields("StaAddress")), "", rsTemp.Fields("StaAddress"))
End With
rsTemp.MoveNext
iIndex = iIndex + 1
Loop
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -