高级记事本父窗体与子窗体的运用
记事本一次可以打开多个文本,可以在父窗体中打开多个子窗体
如Dim frm1 As New Form2
我编的码可以同时打开多个窗口,但无法在窗口中完成替换的功能
这是替换的代码
Dim cz As String = TextBox1.Text
If cz.Length <= 0 Then
MessageBox.Show("请输入要查的内容!")
Return
End If
If chushiweizhi <> 0 Then
frm1.RichTextBox1.SelectionColor = frm1.RichTextBox1.SelectionColor
End If
If chushiweizhi + cz.Length > frm1.RichTextBox1.TextLength Then
MessageBox.Show("已经达文件尾, 是否从文件头开始搜索?", "查找", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
Dim pos As Integer
pos = frm1.RichTextBox1.Find(cz, chushiweizhi, RichTextBoxFinds.MatchCase)
If pos >= 0 Then
frm1.RichTextBox1.SelectionStart = pos
frm1.RichTextBox1.SelectionLength = cz.Length()
previouscolor = frm1.RichTextBox1.SelectionColor
frm1.RichTextBox1.Text = frm1.RichTextBox1.Text.Replace(TextBox1.Text, TextBox3.Text)
chushiweizhi = pos + cz.Length()
Else
MessageBox.Show("未找到指定的文本", "查找")
End If
单独拿出来,可以用,但用到这里,会发现frm1.richtextbox1无法传递过来
始终是0
跪求大佬讲解解决办法