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

📄 frmverdatainput2.frm

📁 本程序是计算三角网闭合差的程序,包括建表,数据库数据输入等完整过程
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FrmVerDataInput2 
   Caption         =   "水准观测数据输入(2/2)"
   ClientHeight    =   6585
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8730
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9.75
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   6585
   ScaleWidth      =   8730
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton CmdEnd 
      Caption         =   "全部结束"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6480
      TabIndex        =   4
      Top             =   5880
      Width           =   1215
   End
   Begin VB.CommandButton CmdSave 
      Caption         =   "保存"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3720
      TabIndex        =   3
      Top             =   5880
      Width           =   1215
   End
   Begin VB.CommandButton CmdUpPage 
      Caption         =   "上一页"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   960
      TabIndex        =   2
      Top             =   5880
      Width           =   1215
   End
   Begin MSFlexGridLib.MSFlexGrid Grid2 
      Height          =   5055
      Left            =   3720
      TabIndex        =   1
      Top             =   720
      Width           =   4335
      _ExtentX        =   7646
      _ExtentY        =   8916
      _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          =   5055
      Left            =   600
      TabIndex        =   0
      Top             =   720
      Width           =   2775
      _ExtentX        =   4895
      _ExtentY        =   8916
      _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 Lbl2 
      Caption         =   "请输入水平方向观测值"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3840
      TabIndex        =   6
      Top             =   240
      Width           =   2055
   End
   Begin VB.Label Lbl1 
      Caption         =   "请输入所有点的点号和点名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   600
      TabIndex        =   5
      Top             =   240
      Width           =   2655
   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.MnuAdjustCal.Enabled = True
  FrmMain.MnuViewResult.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_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 = 1
     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_Dir(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_Dir(I) = Val(Grid2.Text)
  Next I
End Sub

Private Sub VerDataInput2Save()
    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_Dir(I)
            
            .Update
           Next I
        .Close
    End With
End Sub

⌨️ 快捷键说明

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