Question : Position cursor to specified line in multiline textbox

I've a multiline textbox with many lines; I would like to go directly to a specified line typing the row to go. Each line has a variable length.

Answer : Position cursor to specified line in multiline textbox

As far as I know the above method is the only sure way to do it in .NET without having to go through a lot of code logic that can easily be broken. In my example above I was assuming you would use a non zero line index, if you wish to use a zero based index than change  this line:
     Return SendMessage(hwnd, EM_LINEINDEX, lineNumber + 1, 0)
to
     Return SendMessage(hwnd, EM_LINEINDEX, lineNumber, 0)

Let me know if you need more help but this should do what you want.
Random Solutions  
 
programming4us programming4us