How to use reflection on textbox control to allow program control of scrolling?

  • Thread starter Thread starter notu
  • Start date Start date
N

notu

I would like to control a textbox's vertical scroll bar from my application.
I want to add a next page button ability. I'm using a reflector tool to look
at the TextBox control. However I don't see anything that i can use
reflection on to get access to the vertical scroll bar. I was hoping to see
a private field for the scrollbar but i don't see one.



Has anyone tried this?

Can it be done?

Is it in there?



Thanks
 
The TextBox control wraps the native edit control. Therefore in order to
control it you'll need to use the native approach of windows messages.
Specifically you'll need to send the control EM_SCROLL which accepts a
wParam indicating the unit and direction to scroll - you'll need to refer to
the header files in the sdk to get the values of these constants -
windows.h.
In psuedo-code you'll need to:-
get the native window handle of the edit control
(http://www.peterfoot.net/AConsistentWayToGetNativeWindowHandlesHWND.aspx)
send the message to this handle (You can use
Microsoft.WindowsCE.Forms.MessageWindow.SendMessage for this or P/Invoke
SendMessage)

Peter
 
Reflection won't help you. You need to send EM_SCROLL or EM_LINESCROLL
message to the control.
 
Back
Top