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

📄 trana.frm

📁 气象观测数据A文件转换成报表程序
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form TranA 
   Caption         =   "A文件转换程序"
   ClientHeight    =   1950
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4515
   LinkTopic       =   "Form1"
   ScaleHeight     =   1950
   ScaleWidth      =   4515
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "打开文件"
      Height          =   375
      Left            =   3000
      TabIndex        =   6
      Top             =   240
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1560
      TabIndex        =   4
      Top             =   720
      Width           =   2655
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始转换"
      Height          =   375
      Left            =   3000
      TabIndex        =   3
      Top             =   1320
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   2655
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1920
      TabIndex        =   1
      Top             =   1320
      Width           =   735
   End
   Begin MSComDlg.CommonDialog CmdOpen 
      Left            =   2280
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Label Label2 
      Caption         =   "转换后文件名:"
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "输入所在月份日数:"
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   1440
      Width           =   1575
   End
End
Attribute VB_Name = "TranA"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    'PC 气压 TB 气温 EA 水汽压 UB 相对湿度 IB 露点 R6 降水 L0 蒸发 S2 日照
    Dim M, i, j As Integer
    Dim Temp, StrE, StrA, StrB, StrC, StrD, StrH, OutFile As String
    
    M = Val(Text1.Text)
    
    OutFile = Text3.Text
    ChDir App.Path
    Open OutFile For Append As #2
    Open Text2 For Input As #1
        Do While Not EOF(1)
            Line Input #1, StrE
            If StrE = "PC" Or StrE = "TB" Or StrE = "EA" Or StrE = "UB" Then
                Print #2, StrE
                For i = 1 To M
                    Line Input #1, StrA
                    Line Input #1, StrB
                    StrH = StrA + " " + StrB
                    Print #2, StrH
                Next i
                
            End If
        Loop
    Close #1
    
    Open Text2 For Input As #1
        Do While Not EOF(1)
            Line Input #1, StrE
            If StrE = "IB" Then
                Print #2, StrE
                Line Input #1, Temp
                For i = 1 To M
                    Line Input #1, StrA
                    Line Input #1, StrB
                    StrH = StrA + " " + StrB
                    Print #2, StrH
                Next i
                
            End If
        Loop
    Close #1
    
    Open Text2 For Input As #1
        Do While Not EOF(1)
            Line Input #1, StrE
            If StrE = "R6" Or StrE = "L0" Or StrE = "S2" Then
                Print #2, StrE
                For i = 1 To M
                    Line Input #1, StrA
                    Print #2, StrA
                Next i
            End If
        Loop
    Close #1
    
    
    Open Text2 For Input As #1
        Do While Not EOF(1)
            Line Input #1, StrE
            If StrE = "FN" Then
                Print #2, StrE
                For i = 1 To M
                    Line Input #1, StrA
                    Line Input #1, StrB
                    Line Input #1, StrC
                    Line Input #1, StrD
                    StrH = StrA + " " + StrB + " " + StrC + " " + StrD
                    Print #2, StrH
                Next i
            
                Exit Do
            End If
        Loop
    Close #1
    
    Close #2
    

End Sub

Private Sub Command2_Click()
    
    CmdOpen.Filter = "TEXT (*.txt)|*.txt"
    CmdOpen.ShowOpen
    Text2 = CmdOpen.FileName

End Sub

⌨️ 快捷键说明

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