I am trying to place the following code in a scrollbar so when the user moves the scrollbar this code will be fired as well. What it does is it numbers the lines in a textbox. I currently have the code in a timer but I really dont want it in a timer cause its such a waste of resources firing this code every millisecond. If someone could provide me a way to Hook some code to the scrollbar in a richtextbox I would much appreciate it.

Code:
Private Sub Timer1_Timer()
    FirstLine = SendMessage(txtMain.hwnd, EM_GETFIRSTVISIBLELINE, 0&, 0&)
    FirstLine = FirstLine   
 If Not FirstLineNow = FirstLine Then DrawNumbers 
End Sub
Eric Malamisura