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

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
 
P

Peter Foot [MVP]

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
 
A

Alex Feinman [MVP]

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top