📄 frmverdatainput2.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FrmVerDataInput2
Caption = "观测数据输入(2/2)"
ClientHeight = 7635
ClientLeft = 60
ClientTop = 450
ClientWidth = 10365
LinkTopic = "Form1"
ScaleHeight = 7635
ScaleWidth = 10365
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Cmdend
Caption = "结束"
Height = 495
Left = 7920
TabIndex = 6
Top = 6360
Width = 1215
End
Begin VB.CommandButton Cmdsave2
Caption = "保存"
Height = 495
Left = 5400
TabIndex = 5
Top = 6360
Width = 1215
End
Begin VB.CommandButton Cmduppage
Caption = "上一页"
Height = 495
Left = 2760
TabIndex = 4
Top = 6360
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid Grid2
Height = 4095
Left = 4680
TabIndex = 3
Top = 1680
Width = 4215
_ExtentX = 7435
_ExtentY = 7223
_Version = 393216
Cols = 4
End
Begin MSFlexGridLib.MSFlexGrid Grid1
Height = 4095
Left = 960
TabIndex = 2
Top = 1680
Width = 2655
_ExtentX = 4683
_ExtentY = 7223
_Version = 393216
End
Begin VB.Label Label2
Caption = "观测水平方向值"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5880
TabIndex = 1
Top = 840
Width = 2415
End
Begin VB.Label Label1
Caption = "网点名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1800
TabIndex = 0
Top = 960
Width = 1215
End
End
Attribute VB_Name = "FrmVerDataInput2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim wgridcol1, wgridcol2, wgridrow1, wgridrow2 As Integer
Dim FileName1, FileName2 As String, FileName3 As String
Private Sub CmdEnd_Click()
Call VerDataInput2Save
g_Info1 = 1
Set arecord = g_d_Base.OpenRecordset("信息表", dbOpenTable)
With arecord
.Edit
.Fields(0) = 1
.Update
.Close
End With
frmmain.StatusBar1.Panels(1).Text = "观测数据已完成"
frmmain.MnuCalculate.Enabled = True
frmmain.MnuView.Enabled = True
frmmain.MnuViewSpfxValue.Enabled = True
Unload FrmVerDataInput1
Unload FrmVerDataInput2
End Sub
Private Sub CmdSave_Click()
Call VerDataInput2Save
End Sub
Private Sub CmdUpPage_Click()
Load FrmVerDataInput1
FrmVerDataInput1.Show
Unload FrmVerDataInput2
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim RecNum As Integer
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Set arecord = g_d_Base.OpenRecordset("点名表", dbOpenTable)
With arecord
If .RecordCount > 0 Then
RecNum = .RecordCount
.MoveFirst
For i = 1 To RecNum
If .Fields(1) <> "" Then g_PotName(i) = .Fields(1)
If i < RecNum Then
.MoveNext
End If
Next i
End If
End With
arecord.Close
Set arecord = g_d_Base.OpenRecordset("观测数据表", dbOpenTable)
With arecord
If .RecordCount > 0 Then
RecNum = .RecordCount
.MoveFirst
For i = 1 To RecNum
If .Fields(1) <> "" Then g_StaPotName(i) = .Fields(1)
If .Fields(2) <> "" Then g_EndPotName(i) = .Fields(2)
If .Fields(3) <> 0 Then g_LevDirValue(i) = .Fields(3)
If .Fields(3) = 0 Then g_LevDirValue(i) = .Fields(3)
If i < RecNum Then
.MoveNext
End If
Next i
End If
End With
arecord.Close
Grid1.ColWidth(0) = 400
Grid1.ColWidth(1) = 800
Grid2.ColWidth(0) = 400
Grid2.ColWidth(1) = 800
Grid2.ColWidth(2) = 800
Grid2.ColWidth(3) = 1200
Grid1.ColAlignment(0) = 4
Grid1.ColAlignment(1) = 4
Grid2.ColAlignment(0) = 4
Grid2.ColAlignment(1) = 4
Grid2.ColAlignment(2) = 4
Grid2.ColAlignment(3) = 4
Grid1.Row = 0
Grid1.Col = 0
Grid1.Text = "序号"
Grid1.Col = 1
Grid1.Text = "点名"
Grid2.Row = 0
Grid2.Col = 0
Grid2.Text = "序号"
Grid2.Col = 1
Grid2.Text = "测站名"
Grid2.Col = 2
Grid2.Text = "目标名"
Grid2.Col = 3
Grid2.Text = "水平方向值"
Grid1.Rows = g_PotNum + 1
Grid1.Col = 1
Grid1.ColSel = 1
Grid1.Row = 1: Grid1.RowSel = g_PotNum
Grid1.Col = 1
Grid2.Rows = g_ObsNum + 1
Grid2.Col = 1: Grid2.ColSel = 3
Grid2.Row = 1: Grid2.RowSel = g_ObsNum
For i = 1 To g_PotNum
Grid1.Col = 0
Grid1.Row = i
Grid1.Text = Str$(i)
Next i
For i = 1 To g_ObsNum
Grid2.Col = 0
Grid2.Row = i
Grid2.Text = Str$(i)
Next i
For i = 1 To g_PotNum
Grid1.Col = 1
Grid1.Row = i
Grid1.Text = g_PotName(i)
Next i
For i = 1 To g_ObsNum
Grid2.Col = 1
Grid2.Row = i
Grid2.Text = g_StaPotName(i)
Grid2.Col = 2
Grid2.Text = g_EndPotName(i)
Grid2.Col = 3
Grid2.Text = Str$(g_LevDirValue(i))
Next i
End Sub
Private Sub Grid1_KeyPress(KeyAscii As Integer)
Grid1.Col = wgridcol1
Grid1.Row = wgridrow1
If KeyAscii = 8 Then
If Grid1.Text <> "" Then Grid1.Text = Mid(Grid1.Text, 1, Len(Grid1.Text) - 1)
Else
Grid1.Text = Grid1.Text + Chr$(KeyAscii)
End If
End Sub
Private Sub Grid2_KeyPress(KeyAscii As Integer)
Grid2.Col = wgridcol2
Grid2.Row = wgridrow2
If KeyAscii = 8 Then
If Grid2.Text <> "" Then Grid2.Text = Mid(Grid2.Text, 1, Len(Grid2.Text) - 1)
Else
Grid2.Text = Grid2.Text + Chr$(KeyAscii)
End If
End Sub
Private Sub Grid1_RowColChange()
wgridcol1 = Grid1.Col
wgridrow1 = Grid1.Row
End Sub
Private Sub Grid2_RowColChange()
wgridcol2 = Grid2.Col
wgridrow2 = Grid2.Row
End Sub
Private Sub Grid1_LostFocus()
Dim i As Integer
For i = 1 To g_PotNum
Grid1.Col = 1
Grid1.Row = i
If Grid1.Text <> "" Then g_PotName(i) = Grid1.Text
Next i
End Sub
Private Sub Grid2_LostFocus()
Dim i As Integer
For i = 1 To g_ObsNum
Grid2.Col = 1
Grid2.Row = i
If Grid2.Text <> "" Then g_StaPotName(i) = Grid2.Text
Grid2.Col = 2
If Grid2.Text <> "" Then g_EndPotName(i) = Grid2.Text
Grid2.Col = 3
If Grid2.Text <> "" Then g_LevDirValue(i) = Val(Grid2.Text)
Next i
End Sub
Private Sub VerDataInput2Save()
Set arecord = g_d_Base.OpenRecordset("基本信息表", dbOpenTable)
With arecord
.Edit
.Update
.Bookmark = .LastModified
.Close
End With
Set arecord = g_d_Base.OpenRecordset("点名表", dbOpenTable)
With arecord
ic = .RecordCount
If .RecordCount > 0 Then
.MoveFirst
For i = 1 To ic
.Delete
If i < ic Then
.MoveFirst
End If
Next i
End If
For i = 1 To g_PotNum
.AddNew
.Fields(0) = i
If g_PotName(i) <> "" Then .Fields(1) = g_PotName(i)
.Update
Next i
.Close
End With
Set arecord = g_d_Base.OpenRecordset("观测数据表", dbOpenTable)
With arecord
ic = .RecordCount
If .RecordCount > 0 Then
.MoveFirst
For i = 1 To ic
.Delete
If i < ic Then
.MoveFirst
End If
Next i
End If
For i = 1 To g_ObsNum
.AddNew
.Fields(0) = i
If g_StaPotName(i) <> "" Then .Fields(1) = g_StaPotName(i)
If g_EndPotName(i) <> "" Then .Fields(2) = g_EndPotName(i)
.Fields(3) = g_LevDirValue(i)
.Update
Next i
.Close
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -