vb内容查找和替换

D調码农 48 0 RAR 2018-12-08 06:12:43

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click RichTextBox1.LoadFile(TextBox1.Text, RichTextBoxStreamType.RichText) RichTextBox1.Focus() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If RichTextBox1.Modified = True Then RichTextBox1.SaveFile(TextBox1.Text, RichTextBoxStreamType.RichText) ElseIf RichTextBox1. Modified = False Then MessageBox.Show("已保存") RichTextBox1.Focus() End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim str1 As String str1 = TextBox2.Text Str = RichTextBox1.Find(str1, Str, RichTextBoxFinds.MatchCase) If str = -1 Then MessageBox.Show("已查找到文档的结尾!", "查找结束") str = 0 Else str = str + str1.Length End If RichTextBox1.Focus() End Sub Dim str As Integer Private Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged '修改查找文本判定’ str = 0 End Sub End Class

用户评论
请输入评论内容
评分:
暂无评论