Selects an entire line of a normal VB textbox without any API calls.
Selects an entire line of a normal VB textbox without any API calls.
Rate Selects an entire line of a normal VB textbox without any API calls.
(1(1 Vote))
Dim lneCount As Integer
Dim lneTxt As String
lneCount = 0
For a = 1 To Len(txtControl.Text)
If Mid(txtControl.Text, a, 2) = vbCrLf Then
lneCount = lneCount + 1
If lneCount = theLine Then
txtControl.SelStart = (a - 1) - Len(lneTxt)
txtControl.SelLength = Len(lneTxt)
Exit Sub
Else
a = a + 1
lneTxt = ""
End If
Else
lneTxt = lneTxt & Mid(txtControl.Text, a, 1)
End If
If a = Len(txtControl.Text) Then
lneCount = lneCount + 1
If lneCount = theLine Then
txtControl.SelStart = a - Len(lneTxt)
txtControl.SelLength = Len(lneTxt)
Exit Sub
End If
End If
Next a
End Sub
Selects an entire line of a normal VB textbox without any API calls. Comments
No comments yet — be the first to post one!
Post a Comment