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

📄 myreplace.frm

📁 Visual Basic课程举例1 有很好的例题
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1335
      Left            =   720
      TabIndex        =   1
      Text            =   "abcdefgabcdecd"
      Top             =   720
      Width           =   3015
   End
   Begin VB.CommandButton Command1 
      Caption         =   "替换"
      Height          =   735
      Left            =   960
      TabIndex        =   0
      Top             =   2160
      Width           =   2415
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Public Function MyReplace(s$, OldS$, NewS$) As String
    Dim i%, lenOldS%
    lenOldS = Len(OldS)
    i = InStr(s, OldS)
    Do While i > 0
        '注意下式是是如何用MID来代替RIGHT的
        s = Left(s, i - 1) + NewS + Mid(s, i + lenOldS)
        i = InStr(s, OldS)
    Loop
    MyReplace = s
End Function

Private Sub Command1_Click()
    Text1 = MyReplace(Text1, "cd", "3")
    Print MyReplace("Visual Basic 程序设计教程5.0版", "5.0", "6.0")
End Sub

⌨️ 快捷键说明

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