在vb中,怎么样可以定位到textbox中多行文本内容的特定的某一行?比如说第五行怎么描述?谢谢
展开全部
定位到第五行
Private Sub Text1_DblClick()
Dim strat As Integer
start = 1
For i = 1 To 4
start = InStr(start, Text1.Text, vbCrLf)
start = start + 1
Next
Text1.SelStart = start
End Sub
Private Sub Text1_DblClick()
Dim strat As Integer
start = 1
For i = 1 To 4
start = InStr(start, Text1.Text, vbCrLf)
start = start + 1
Next
Text1.SelStart = start
End Sub
追问
那我想知道我点的那一行(在多行中随意选择)是第几行,又怎么描述呢?
追答
Dim n As Integer
For i = 1 To Text1.SelStart
If Mid(Text1.Text, i, 2) = vbCrLf Then
n = n + 1
End If
Next
MsgBox "你选的是第" & n + 1 & "行"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询