分类：电脑/网络-互联网
问题：用VB怎样实现关键字的上面一行自动加序号？ 
回答：...来了hi我 - - *** Private Sub Command1_Click() Dim x As String Dim js As String Dim n(100) As Long Dim a(100) As String x = Text2 n(0) = InStr(1, x, Text1) If n(0) > 0 Then a(0) = Mid(x, 1, n(0) - 1) & CStr(1) & "." & Text1 y = a(0) For i = 1 To 100 n(i) = InStr(n(i - 1) + 1, x, Text1) If n(i) > 0 Then a(i) = Mid(x, n(i - 1) + 1, n(i) - n(i - 1) - 1) & CStr(i + 1) & "." & Text1 y = y & a(i) Else js = Right(x, Len(x) - n(i - 1)) y = y & js Exit For End If Next i End If Text2 = y End Sub*******''看下面, 这回完全按照你的要求了 - -!''text1输入关键字,点按钮后,text2就会打印出你想要的东东啦!''对了 - - 别把text1跟text2又搞反了!!''还有,下面的C:\1.txt是你的文件路径...你根据情况自己改!Private Sub Command1_Click()Dim x As StringDim n As IntegerDim s(100) As StringOpen "C:\1.txt" For Input As #1       '''''''************这里的C:\1.txt修改成你的文件地址Do While Not EOF(1)Line Input #1, s(i)n = n + 1i = i + 1DoEventsLoopClose #1For i = 1 To nIf InStr(1, s(i), Text1) > 0 Thens(i - 1) = CStr(i / 2 + 0.5) & "." & s(i - 1)x = x & s(i - 1) & vbCrLf & s(i) & vbCrLfEnd IfNext iText2 = xEnd Sub