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

📄 读数据排序.frm

📁 蒋加伏主编VB程序设计第四版PPT及全部课本源码 北京邮电大学出版社 Visual Basic 程序设计教程(第四版) 主编 蒋加伏 张林峰 找了好久的(不带密码的)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "例[10-9] 访问文件并排序"
   ClientHeight    =   2955
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4410
   LinkTopic       =   "Form1"
   ScaleHeight     =   2955
   ScaleWidth      =   4410
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   855
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   4
      Top             =   120
      Width           =   4095
   End
   Begin VB.TextBox Text2 
      Height          =   855
      Left            =   120
      MultiLine       =   -1  'True
      ScrollBars      =   1  'Horizontal
      TabIndex        =   3
      Top             =   1920
      Width           =   4095
   End
   Begin VB.CommandButton C3 
      Caption         =   "存盘"
      Height          =   495
      Left            =   3000
      TabIndex        =   2
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton C2 
      Caption         =   "排序"
      Height          =   495
      Left            =   1560
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton C1 
      Caption         =   "读数据"
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   1200
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(20) As Integer
Private Sub C1_Click()
  Dim k As Integer, ch As String
  Open "d:\in5.txt" For Input As #1
  ch = ""
  For k = 1 To 20
    Input #1, a(k)
    ch = ch + Str(a(k)) + " "
    If k Mod 10 = 0 Then ch = ch + Chr(13) + Chr(10)
  Next k
  Close #1
  Text1.Text = ch
End Sub
Private Sub C2_Click()
  Dim i%, j%, t%
  For i = 20 To 2 Step -1
    For j = 1 To i - 1
      If a(j) > a(j + 1) Then
        t = a(j): a(j) = a(j + 1): a(j + 1) = t
      End If
    Next j
  Next i
  Text2.Text = ""
  For i = 1 To 20
    Text2.Text = Text2.Text & a(i) & "  "
    If i Mod 10 = 0 Then Text2.Text = Text2.Text & Chr(13) + Chr(10)
  Next i
End Sub
Private Sub C3_Click()
  Open "d:\out5.txt" For Output As #1
  Print #1, Text2.Text
  Close #1
End Sub

⌨️ 快捷键说明

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