how to do a strange scrool

i have a text box an in it is more text then can fit, so i use the vertical scrool bar to scrol, i want to use the up and down keys to scrol up and down one line at a time any ideas.
kplonkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
Set the ScrollBars property of the TextBox to 3 - Both, or 2 - Vertical.
Then the up and down keys will move the caret up and down one line and the scroll bars will reflect the change.
0
kplonkAuthor Commented:
no no you are missing the point. I do not want to use the curser in the box becaus if i am on the top line of the box an i wan to scrol one line off the bottom then i will need to press the down arrow 11 times, get the idea. Thanks anyway, reguards kieran.
0
KDivadCommented:
Ther is a SendMessage parameter that can be used to scroll the box like you want, but I can't remember it.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

WatsonRCommented:
You could try this...

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    Const EM_LINESCROLL = &HB6
    Select Case KeyCode
    Case vbKeyDown: SendMessage Text1.hWnd, EM_LINESCROLL, 0, ByVal 1
    Case vbKeyUp:   SendMessage Text1.hWnd, EM_LINESCROLL, 0, ByVal -1
    End Select
End Sub

Ross
0
KDivadCommented:
Yep, that's the one.
0
WatsonRCommented:
Glad to help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KDivadCommented:
Glad you posted, because I lost this bit of code a couple of weeks ago! Now we just have to wait for kplonk to come back and accept it.
0
WatsonRCommented:
kplonk,

if you accept this answer, may I suggest you accept KDivad's post, as it was his information that led to my post.

Regards,
Ross
0
Erick37Commented:
But what does the code do?
The TextBox already scrolls with the up/down key.
0
Erick37Commented:
Ohhh,
Now I get it.
The caret stays at the top!   :-)
0
WatsonRCommented:
Well yes, but if your text box is, say, 5 lines high, and the carat is in line one, I understood that the desired effect of a down arrow was to scroll the display by one line (thus having the 2nd line at the top) as opposed to having the carat move to line 2. Therefore, if you wanted to see line 6, you pressed down arrow once as opposed to 6 times.
0
KDivadCommented:
WatsonR,
Accept mine instead of yours? Or both?

Erick37,
As you've probably figured out, this code sends a message to the textbox telling it to move it's scrollbars just as they would if you were to use the mouse on the scrollbars.

To all,
I THINK passing the numbers in the third parameter do a horizontal scroll.

Later,
0
WatsonRCommented:
KDivad

I was being magnanamous and suggesting that, without your post, writing a solution would have taken longer - and thereby suggesting that kplonk should accept your post as the answer.

Ross
0
KDivadCommented:
I appreciate that, I just wasn't sure since it came after you posted an answer.

Later,
KDivad Leahcim
0
kplonkAuthor Commented:
sorted mate
0
KDivadCommented:
Nice gesture anyway, WatsonR. You did give the code, though.

Later,
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.