Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Jan 29, 2000

The first visible line in a multiline TextBox control

To determine the index of the first visible line in a multiline TextBox control you only need to send it the EM_GETFIRSTVISIBLELINE message:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
    hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long
Const EM_GETFIRSTVISIBLELINE = &HCE

FirstVisibleLine = SendMessage(Text1.hwnd, EM_GETFIRSTVISIBLELINE, 0, ByVal 0&)
The previous of code returns the index of the first visible line (0 for the first line in the TextBox). When applied to a single-line control, this code returns the index of the first visible character (0 for the first character in the Text property).
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date