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

📄 datafile.frm

📁 Serial Port Complete, Programming and Circuits for RS-232 and RS-485 Links and Networks
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Begin VB.Form frmDataFile 
   Caption         =   "Serial Port Complete"
   ClientHeight    =   1932
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   3744
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   1932
   ScaleWidth      =   3744
   StartUpPosition =   1  'CenterOwner
   Begin VB.Frame fraAppendOverwrite 
      BorderStyle     =   0  'None
      Height          =   612
      Left            =   600
      TabIndex        =   5
      Top             =   960
      Width           =   1212
      Begin VB.OptionButton optAppendOrOverwrite 
         Caption         =   "Overwrite"
         Height          =   252
         Index           =   1
         Left            =   0
         TabIndex        =   7
         Top             =   240
         Width           =   1332
      End
      Begin VB.OptionButton optAppendOrOverwrite 
         Caption         =   "Append"
         Height          =   252
         Index           =   0
         Left            =   0
         TabIndex        =   6
         Top             =   0
         Width           =   1332
      End
   End
   Begin VB.CommandButton cmdSelectFile 
      Caption         =   "Select File"
      Height          =   612
      Left            =   2400
      TabIndex        =   4
      Top             =   240
      Width           =   1212
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Height          =   612
      Left            =   2400
      TabIndex        =   3
      Top             =   1080
      Width           =   1212
   End
   Begin VB.Frame fraDataFile 
      Height          =   1572
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2052
      Begin VB.OptionButton optDataFile 
         Caption         =   "Save Data in File"
         Height          =   252
         Index           =   1
         Left            =   120
         TabIndex        =   2
         Top             =   480
         Width           =   1692
      End
      Begin VB.OptionButton optDataFile 
         Caption         =   "No Save"
         Height          =   252
         Index           =   0
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   1212
      End
   End
   Begin MSComDlg.CommonDialog cdlDataFile 
      Left            =   360
      Top             =   1920
      _ExtentX        =   677
      _ExtentY        =   677
      _Version        =   327681
   End
End
Attribute VB_Name = "frmDataFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Enables the user to select a file for storing data.
Dim DataFile As String

Private Sub cmdOK_Click()
Hide
Close #2
If optDataFile(1).Value = True Then
    If optAppendOrOverwrite(0).Value = True Then
        Open DataFile For Append As #2
    Else
        Open DataFile For Output As #2
    End If
End If
End Sub

Private Sub cmdSelectFile_Click()
cdlDataFile.Filter = "All files (*.*)|*.*"
cdlDataFile.filename = DataFile
cdlDataFile.Flags = cdlOFNPathMustExist
cdlDataFile.Flags = cdlOFNOverwritePrompt
cdlDataFile.Flags = cdlOFNCreatePrompt
'Get the selected file from the common dialog box.
cdlDataFile.ShowOpen
If cdlDataFile.filename <> "" Then
    'Save the filename and path.
    DataFile = cdlDataFile.filename
    cmdOK.Enabled = True
Else
    cmdOK.Enabled = False
End If
End Sub

Private Sub Form_Load()
optDataFile(0).Value = True
Call GetSettings
End Sub

Private Sub GetSettings()
DataFile = GetSetting(ProjectName, "DataFile", "DataFile", "")
End Sub

Private Sub Form_Unload(Cancel As Integer)
Call SaveSettings
End Sub

Private Sub optDataFile_Click(Index As Integer)
'Configure the display elements.
If optDataFile(0).Value = True Then
    optAppendOrOverwrite(0).Enabled = False
    optAppendOrOverwrite(1).Enabled = False
    cmdSelectFile.Enabled = False
    SaveDataInFile = False
    cmdOK.Enabled = True
Else
    optAppendOrOverwrite(0).Enabled = True
    optAppendOrOverwrite(1).Enabled = True
    optAppendOrOverwrite(0).Value = True
    cmdSelectFile.Enabled = True
    SaveDataInFile = True
    cmdOK.Enabled = False
    'Bring up the dialog box to select a file.
    cmdSelectFile.Value = True
End If
End Sub

Private Sub SaveSettings()
SaveSetting ProjectName, "DataFile", "DataFile", DataFile
End Sub

⌨️ 快捷键说明

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