急!急!急!请教VB高手们,一个超级字符比较软件(回答满意后再加高分)

来源:百度知道 编辑:UC知道 时间:2024/05/29 16:11:42
有一些数据:(无规律,全是数字)
61516151348443848464
3443834754434126164465461
549848749464
5446464646464
等等

要求在其中能竖着搜索数字:
比如能在其中搜索"386"
它能够反白显示第二排的第三个数字3,因为第三排,第四排的第三个数字是8和6,合起来为"386"

还要搜索出了第一个,能接着搜索,直至搜索到文件尾.

因为搜索的内容很多,所以存贮数字的文本框要用RichTextBox
先行谢过!!!

Private Sub Command1_Click()
arr = Split(RichTextBox1.Text, vbCrLf)
If UBound(arr) < 2 Then Exit Sub
For i& = 0 To UBound(arr) - 2
Do
DoEvents
p3 = InStr(p3& + 1, arr(i), "3")
If p3 Then
If (Len(arr(i + 1)) > p3) And (Len(arr(i + 2)) > p3) Then
If Mid$(arr(i + 1), p3, 1) = "8" And Mid$(arr(i + 2), p3, 1) = "6" Then
For j& = -1 To 1
Call SetSelColor(i + j, p3 - 1)
Next
End If
End If
End If
Loop While p3
Next i
RichTextBox1.SelStart = 0
End Sub

Sub SetSelColor(r&, p&)
Debug.Print r, p
RichTextBox1.SetFocus
RichTextBox1.SelStart = 0
For i& = 0 To r
SendKeys "{DOW