高分,vb的text中如何提取特征行

来源:百度知道 编辑:UC知道 时间:2024/06/25 19:25:11
如text1为【第4302行】01,15,25,29,46,【第1203行】07,20,42,43,46,【第3304行】14,21,24,25,47,【第4305行】03,07,13,34,48,text2为0124按下按钮text3中显示:【第4302行】01,15,25,29,46,【第3304行】14,21,24,25,47,就是把有text2特征的行给提取出来,需要能运行的完整代码,运算越快越好,谢谢了。

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_GETLINE = &HC4

Private Sub Command1_Click()
Dim str(256) As Byte
str(1) = 1 '最大允许存放256个字符
'获取总行数,结果显示在文本框txtLineCount中
txtlineCount = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, 0)
'获取第3行的数据放在str中,转换为字符串后显示在文本框txtString中
SendMessage Text1.hwnd, EM_GETLINE, 2, str(0)
txtString = StrConv(str, vbUnicode)
End Sub
给你点提示咯