如何做文本内容比较?
有2个文本框text1和text2,要求后期输入内容,例如在text1中输入20个名字,在text2中输入5个名字,而且是每个姓名占据一行,然后通过按钮确认进行比较(逐行名字比较),如果text2中的名字在text1中出现,则该名字输出到text3中;如果text2中的名字不在text1中出现,则该名字输出到text4中!请问这样要如何实现,可否把代码写给小弟学习?
Private Sub Form_Load() For i = 1 To 20 Text1.Text = Text1.Text & i & vbCrLf Next For i = 1 To 5 Text2.Text = Text2.Text & i & vbCrLf Next For i = 0 To UBound(Split(Text1.Text, vbCrLf)) cz = 0 For j = 0 To UBound(Split(Text2.Text, vbCrLf)) If Split(Text1.Text, vbCrLf)(i) = Split(Text2.Text, vbCrLf)(j) Then cz = 1 End If Next If cz = 1 Then If Split(Text1.Text, vbCrLf)(i) <> "" Then Text3.Text = Text3.Text & Split(Text1.Text, vbCrLf)(i) & vbCrLf End If End If Next End Sub