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

📄 pipedata-input.frm

📁 控件属性的自动录入
💻 FRM
📖 第 1 页 / 共 5 页
字号:
      End
      Begin VB.Label Label8 
         Caption         =   "所属管线"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   8640
         TabIndex        =   34
         Top             =   2700
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "管段类别"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   8640
         TabIndex        =   33
         Top             =   2310
         Width           =   855
      End
   End
   Begin VB.Label Label17 
      Caption         =   "不连续编码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   60
      Top             =   4140
      Width           =   1095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub szbt()
  '该函数用于设置显示控件每列的标题和宽度

  DataGrid1.ColWidth(0) = 220
  
  DataGrid1.TextMatrix(0, 1) = "管段编码"
  
  
  DataGrid1.TextMatrix(0, 2) = "所属水系"
  
  
  DataGrid1.TextMatrix(0, 3) = "管段名称"
  DataGrid1.ColWidth(3) = 3000
  
  DataGrid1.TextMatrix(0, 4) = "起止点名"
  DataGrid1.ColWidth(4) = 3000
  
  DataGrid1.TextMatrix(0, 5) = "箱涵宽或管径"
  DataGrid1.ColWidth(5) = 1500
  
  DataGrid1.TextMatrix(0, 6) = "箱涵高"
   DataGrid1.ColWidth(6) = 1500
  
  DataGrid1.TextMatrix(0, 7) = "管线长度"
  DataGrid1.ColWidth(7) = 1500
  
  DataGrid1.TextMatrix(0, 8) = "起点标高"
  DataGrid1.ColWidth(8) = 1500
  
  DataGrid1.TextMatrix(0, 9) = "终点标高"
  DataGrid1.ColWidth(9) = 1500
  
  DataGrid1.TextMatrix(0, 10) = "溢流井数"
  
  
  DataGrid1.TextMatrix(0, 11) = "沉泥井数"
  
  
  DataGrid1.TextMatrix(0, 12) = "节制闸数"
  
  
  DataGrid1.TextMatrix(0, 13) = "检查井数"
  
  
  DataGrid1.TextMatrix(0, 14) = "进水井数"
  
  
  DataGrid1.TextMatrix(0, 15) = "出水闸数"
  
  
  DataGrid1.TextMatrix(0, 16) = "进水支管长度"
  DataGrid1.ColWidth(16) = 1500
  
  DataGrid1.TextMatrix(0, 17) = "管段等级"
  
  
  DataGrid1.TextMatrix(0, 18) = "管段类别"
  
   
  DataGrid1.TextMatrix(0, 19) = "结构"
  
  
  DataGrid1.TextMatrix(0, 20) = "排数"
  
  
  DataGrid1.TextMatrix(0, 21) = "所属管线"
  DataGrid1.ColWidth(21) = 3000
  
  DataGrid1.TextMatrix(0, 22) = "所属泵站"
  
  
  DataGrid1.TextMatrix(0, 23) = "所属污水处理厂"
  DataGrid1.ColWidth(23) = 1800
  
  DataGrid1.TextMatrix(0, 24) = "所属出口闸"
  
  
  DataGrid1.TextMatrix(0, 25) = "上级管段编码"
  DataGrid1.ColWidth(25) = 1500
  
  DataGrid1.TextMatrix(0, 26) = "所在道路名称"
  DataGrid1.ColWidth(26) = 3000
  
   DataGrid1.TextMatrix(0, 27) = "所属行政区"

End Sub




Private Sub Combo1_LostFocus()

        Combo9.Text = Combo1.Text

End Sub

Private Sub Combo2_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
      Text2.SetFocus
   End If
End Sub



Private Sub Command3_Click()
'查询
  Dim t1 As String
  Dim t2 As String
  Dim t3 As Long
  Dim X, y1, y2, y3 As Long
  
  If Len(Trim(Combo1.Text)) < 2 And Len(Trim(Combo2.Text)) < 2 Then
    MsgBox ("查询时,区码水系不能同时为空!")
    Exit Sub
  End If
  
  t1 = Mid(Trim(Combo1.Text), 1, 2) + Trim(Text1.Text) + "%"
  t2 = Mid(Trim(Combo2.Text), 1, 2) + "%"
  
  If (IsNumeric(Mid(Trim(Combo2.Text), 1, 4))) Then
    t2 = Mid(Trim(Combo2.Text), 1, 4) + "%"
  End If
  
  Adodc1.RecordSource = "Select * from ghd where PipeSegId  like  '" & t1 & "' and  BeloWaterSys like  '" & t2 & "' "
  Adodc1.Refresh
  Set DataGrid1.DataSource = Adodc1.Recordset
  
  
  '设置标题
  szbt
  DataGrid1.TextMatrix(DataGrid1.Row, 0) = "*"
  
  t3 = 0
  t3 = Adodc1.Recordset.RecordCount
  If DataGrid1.TextMatrix(1, 1) = "" Then
    t3 = t3 - 1
  End If
  
  t2 = "满足查询条件的记录数为" + Str(t3)
  MsgBox (t2)

 
 Combo7.Clear
 For X = 1 To t3 - 1 Step 1
   y1 = DataGrid1.TextMatrix(X, 1)
   y2 = DataGrid1.TextMatrix(X + 1, 1)
    If (CLng(y2) - CLng(y1)) <> 1 Then
       Combo7.AddItem (y2)
    End If
 Next
     

End Sub

Private Sub Command1_Click()
  '关闭窗口
  Unload Me
End Sub

Private Sub Command2_Click()
  '添加记录
  
  Dim mrc As ADODB.Recordset
  Dim txtSQL As String
  Dim MsgText As String
  Dim X, i, j As Long
  Dim t As String
  
  Set mrc = New ADODB.Recordset
  
  '对数字型字段输入为空的处理
  Text1.Text = Right("00000" + Trim(Text1.Text), 5)
  
  If Text4.Text = "" Then
    Text4.Text = "0"
  End If
  
  If Text5.Text = "" Then
    Text5.Text = "0"
  End If
   
  
  If Text6.Text = "" Then
    Text6.Text = "0"
  End If
  
  If Text7.Text = "" Then
    Text7.Text = "0"
  End If
  
  If Text8.Text = "" Then
    Text8.Text = "0"
  End If
  
  If Text9.Text = "" Then
    Text9.Text = "0"
  End If
  
  If Text10.Text = "" Then
    Text10.Text = "0"
  End If
  
  If Text11.Text = "" Then
    Text11.Text = "0"
  End If
  
  If Text12.Text = "" Then
    Text12.Text = "0"
  End If
  
  If Text13.Text = "" Then
    Text13.Text = "0"
  End If
  
  If Text14.Text = "" Then
    Text14.Text = "0"
  End If
  
  If Text15.Text = "" Then
    Text15.Text = "0"
  End If
  
  
  '对每个字段的合法性进行判断
  If Len(Trim(Combo1.Text)) < 2 Then
      MsgBox ("区号必须为2位以上字符!")
     Exit Sub
  End If
    
   If Not (IsNumeric(Mid(Trim(Combo1.Text), 1, 2))) Then
     MsgBox ("区号必须为2位数字字符!")
     Exit Sub
  End If
  
  If (Not IsNumeric(Trim(Text1.Text))) Or (Len(Trim(Text1.Text)) <> 5) Then
     MsgBox ("管线流水号必须为5位数字字符!")
     Exit Sub
  End If
    
   If Len(Trim(Combo2.Text)) > 0 And Not (IsNumeric(Mid(Trim(Combo2.Text), 1, 2))) Then
     MsgBox ("水系必须为2位以上数字字符!")
     Exit Sub
  End If

  If Trim(Text2.Text) = "" Then
    MsgBox ("管段名称不能为空!")
    Exit Sub
  End If
  
  If Not IsNumeric(Trim(Text4.Text)) Then
    MsgBox ("箱涵宽(或管径)输入错误!")
    Exit Sub
  End If
  
  If CDbl(Trim(Text4.Text)) > 32767 Or CDbl(Trim(Text4.Text)) < 0 Then
    MsgBox ("箱涵宽(或管径)超出范围!")
    Exit Sub
  End If
  
  If Not IsNumeric(Trim(Text5.Text)) Then
    MsgBox ("箱涵高输入错误!")
    Exit Sub
  End If
  
  If CDbl(Trim(Text5.Text)) > 32767 Or CDbl(Trim(Text5.Text)) < 0 Then
    MsgBox ("箱涵高超出范围!")
    Exit Sub
  End If
  
  If Not IsNumeric(Trim(Text6.Text)) Then
    MsgBox ("管线长度输入错误!")
    Exit Sub
  End If
  
  If CDbl(Trim(Text6.Text)) > 100000 Or CDbl(Trim(Text6.Text)) < 0 Then
    MsgBox ("管线长度超出范围!")
    Exit Sub
  End If
    
  If Not IsNumeric(Trim(Text7.Text)) Then
    MsgBox ("起始点管底标高输入错误!")
    Exit Sub
  End If
  
  If CDbl(Trim(Text7.Text)) > 32767 Or CDbl(Trim(Text7.Text)) < 0 Then
    MsgBox ("起始点管底标高超出范围!")
    Exit Sub
  End If
  
  If Not IsNumeric(Trim(Text8.Text)) Then
    MsgBox ("终始点管底标高数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text8.Text)) > 32767 Or CDbl(Trim(Text8.Text)) < 0 Then
    MsgBox ("终始点管底标高超出范围!")
    Exit Sub
  End If
  
  If Not IsNumeric(Trim(Text9.Text)) Then
    MsgBox ("溢流井数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text9.Text)) > 32767 Or CDbl(Trim(Text9.Text)) < 0 Then
    MsgBox ("溢流井超出范围!")
    Exit Sub
  End If
 
  If Not IsNumeric(Trim(Text10.Text)) Then
    MsgBox ("沉泥井数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text10.Text)) > 32767 Or CDbl(Trim(Text10.Text)) < 0 Then
    MsgBox ("沉泥井超出范围!")
    Exit Sub
  End If
 
  If Not IsNumeric(Trim(Text11.Text)) Then
    MsgBox ("节制闸数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text11.Text)) > 32767 Or CDbl(Trim(Text11.Text)) < 0 Then
    MsgBox ("节制闸超出范围!")
    Exit Sub
  End If
  
   If Not IsNumeric(Trim(Text12.Text)) Then
    MsgBox ("检查井数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text12.Text)) > 32767 Or CDbl(Trim(Text12.Text)) < 0 Then
    MsgBox ("检查井超出范围!")
    Exit Sub
  End If
 
    If Not IsNumeric(Trim(Text13.Text)) Then
    MsgBox ("进水井数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text13.Text)) > 32767 Or CDbl(Trim(Text13.Text)) < 0 Then
    MsgBox ("进水井超出范围!")
    Exit Sub
  End If
 
   If Not IsNumeric(Trim(Text14.Text)) Then
    MsgBox ("出水闸数据错误!")
    Exit Sub
  End If
    
  If CDbl(Trim(Text14.Text)) > 32767 Or CDbl(Trim(Text14.Text)) < 0 Then
    MsgBox ("出水闸超出范围!")

⌨️ 快捷键说明

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