VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Selects an entire line of a normal VB textbox without any API calls.

by SirCodezAlot (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Sun 25th August 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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.




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


Download this snippet    Add to My Saved Code

Selects an entire line of a normal VB textbox without any API calls. Comments

No comments have been posted about Selects an entire line of a normal VB textbox without any API calls.. Why not be the first to post a comment about Selects an entire line of a normal VB textbox without any API calls..

Post your comment

Subject:
Message:
0/1000 characters