# Re: 请问RichTextBox..

Posted by 小琳 on August 07, 1999 at 17:20:35:

In Reply to: 请问RichTextBox.. posted by 小洪 on August 07, 1999 at 15:38:36:

: 请问在richtextbox中如何在第n行中
: 的第几个字元开始插入文字呢?

:::程式如下:
Option Explicit

Private Sub Command1_Click()
Dim i As Integer, a As Integer, b As Integer
i = 0
a = 0
b = 0
i = InStr(1, RichTextBox1.Text, Chr(10))
a = 1
Do While a < Val(Text1)
b = i
i = InStr(i + 1, RichTextBox1.Text, Chr(10))
a = a + 1
Loop
RichTextBox1.Text = Left(RichTextBox1.Text, b) & Mid(RichTextBox1.Text, b + 1, Val(Text2)) & Trim(Text3.Text) & Mid(RichTextBox1.Text, b + Val(Text2) + 1)
MsgBox RichTextBox1.Text
End Sub

Follow Ups:

- Re: 请问RichTextBox.. 小瓜瓜 02:00:36 8/16/99 (0)