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

📄 change.vb

📁 用于richtext框中
💻 VB
字号:
Imports System.IO

Public Class Change
    Dim mytext As String

    Public Sub mychange(ByVal path As String, ByVal oldstring As String, ByVal newstring As String)
        'path为要修改的文件路径 oldstring为要修改的字符串 newstring为修改后的字符串
        Try
            '读取文件
            Using myStreamReader As StreamReader = File.OpenText(path)
                mytext = myStreamReader.ReadToEnd()
            End Using
            '更改
            mytext = mytext.Replace(oldstring, newstring)
            '写回
            My.Computer.FileSystem.WriteAllText(path, mytext, False)
        Catch ex As Exception
            MsgBox("文件操作出错")
        End Try
    End Sub
End Class

⌨️ 快捷键说明

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