📄 frmdatainput2.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form Frmdatainput2
AutoRedraw = -1 'True
Caption = "方向输入(2/2)"
ClientHeight = 5190
ClientLeft = 60
ClientTop = 420
ClientWidth = 8310
LinkTopic = "Form1"
ScaleHeight = 5190
ScaleWidth = 8310
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdEnd
Caption = "全部结束"
Height = 495
Left = 5760
TabIndex = 2
Top = 4440
Width = 1215
End
Begin VB.CommandButton CmdUpPage
Caption = "上一页"
Height = 495
Left = 720
TabIndex = 1
Top = 4440
Width = 1215
End
Begin VB.CommandButton CmdSave
Caption = "保存"
Height = 495
Left = 3480
TabIndex = 0
Top = 4440
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid Grid2
Height = 3375
Left = 3480
TabIndex = 3
Top = 720
Width = 3855
_ExtentX = 6800
_ExtentY = 5953
_Version = 393216
Cols = 4
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 MSFlexGridLib.MSFlexGrid Grid1
Height = 3495
Left = 600
TabIndex = 4
Top = 720
Width = 2055
_ExtentX = 3625
_ExtentY = 6165
_Version = 393216
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 Label2
AutoSize = -1 'True
Caption = "请输入所有方向观测值:"
Height = 180
Left = 3600
TabIndex = 6
Top = 360
Width = 1980
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请输入所有点名:"
Height = 180
Left = 600
TabIndex = 5
Top = 360
Width = 1440
End
End
Attribute VB_Name = "Frmdatainput2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim wgridcol1, wgridrow1, wgridcol2, wgridrow2 As Integer
Dim i As Integer
Private Sub CmdEnd_Click()
Call VerDataInput2Save
Set arecord = g_d_Base.OpenRecordset("信息表", dbOpenTable)
With arecord
.Edit
.Fields(0) = 1
.Update
.Close
End With
FrmMain.StatusBar1.Panels(1).Text = "观测数据已完成"
End Sub
Private Sub CmdSave_Click()
Call VerDataInput2Save
End Sub
Private Sub CmdUpPage_Click()
Load Frmdatainput1
Frmdatainput1.Show
Unload Frmdatainput2
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim Recnum As Integer
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) <> "" Then g_Dir(i) = .Fields(3)
If .Fields(3) = 0 Then g_Dir(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
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 = g_Dir(i)
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_Dir(i) = Val(Grid2.Text)
Next
End Sub
Private Sub VerDataInput2Save()
Dim ic
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_Dir(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_Potnum
.AddNew
.Fields(0) = i
If g_Potname(i) <> "" Then .Fields(1) = g_Potname(i)
.Update
Next i
.Close
End With
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 grid2_RowColChange()
wgridcol2 = Grid2.Col
wgridrow2 = Grid2.Row
End Sub
Private Sub Grid1_RowColChange()
wgridcol1 = Grid1.Col
wgridrow1 = Grid1.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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -