?? 數據文件_編輯f1.frm
字號:
VERSION 5.00
Begin VB.Form frmDisplayRowCol
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "顯示文件的列數和行數、總行數"
ClientHeight = 2025
ClientLeft = 60
ClientTop = 345
ClientWidth = 6420
LinkTopic = "Form1"
ScaleHeight = 2025
ScaleWidth = 6420
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Caption = "退 出"
Height = 375
Left = 4920
TabIndex = 9
ToolTipText = "結束程序運行"
Top = 1440
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "確 定"
Height = 375
Left = 3600
TabIndex = 8
ToolTipText = "單擊后,按列數或行數或用文本框或用網格"
Top = 1440
Width = 1215
End
Begin VB.Label lblRowAllCount
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 375
Left = 4800
TabIndex = 7
Top = 720
Width = 975
End
Begin VB.Label lblRowCount
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 375
Left = 2520
TabIndex = 6
Top = 720
Width = 975
End
Begin VB.Label lblColCount
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 375
Left = 600
TabIndex = 5
Top = 720
Width = 975
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "(包括圖題、列標和行標)"
ForeColor = &H80000008&
Height = 375
Left = 4080
TabIndex = 4
Top = 360
Width = 2415
End
Begin VB.Label Label4
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "(不計圖題、列標和行標)"
ForeColor = &H80000008&
Height = 375
Left = 1920
TabIndex = 3
Top = 360
Width = 2295
End
Begin VB.Label Label3
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "文件的總行數"
ForeColor = &H80000008&
Height = 255
Left = 4440
TabIndex = 2
Top = 120
Width = 1695
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "文件的行數"
ForeColor = &H80000008&
Height = 255
Left = 2160
TabIndex = 1
Top = 120
Width = 1695
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "文件的列數"
ForeColor = &H80000008&
Height = 255
Left = 240
TabIndex = 0
Top = 120
Width = 1695
End
End
Attribute VB_Name = "frmDisplayRowCol"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'顯示文件的列數、行數和總行數
Option Explicit
Private Sub Form_Load()
Dim vntA As Variant, intI As Integer, intJ As Integer
intFileNumber = FreeFile '取得文件號碼
Open strFileName For Input As intFileNumber '打開文件
Input #intFileNumber, vntA '讀列數
intCol = vntA
lblColCount = intCol '在標簽中顯示列數
For intJ = 2 To intCol '讀*******
Input #intFileNumber, vntA
Next intJ
Input #intFileNumber, vntA '讀行數
intRow = vntA
lblRowCount = intRow '在標簽中顯示行數
For intJ = 2 To intCol '讀*******
Input #intFileNumber, vntA
Next intJ
Input #intFileNumber, vntA '讀總行數
intRowAll = vntA
lblRowAllCount = intRowAll '在標簽中顯示總行數
For intJ = 2 To intCol '讀*******
Input #intFileNumber, vntA
Next intJ
Close
End Sub
'確定
Private Sub cmdOK_Click()
Unload Me '卸載當前窗體
blnTitle = False: blnRowLabel = False: blnColLabel = False
'優先考慮圖題
If intRowAll > intRow + 3 Then blnTitle = True
'其次考慮行標
If intRowAll > 2 * intRow Then blnRowLabel = True
'最后考慮列標
If intRowAll = 2 * intRow + 5 Then blnColLabel = True
'按行數和列數重新定義數組
ReDim vntArray(1 To intRowAll, 1 To intCol)
If intRowAll > 30 Or intCol > 14 Then
'30和14這兩個參數與顯示屏有關,需要按實際情況修改
frmGrid.Visible = True '顯示網格編輯數據窗體
Else
frmText.Visible = True '顯示文本框編輯數據窗體
End If
End Sub
'退出
Private Sub cmdExit_Click()
Unload Me
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -