PDA

View Full Version : [SOLVED] Userform textbox scrollbar



mvidas
08-24-2004, 07:59 AM
Hi Everyone,

I'm assuming this is a very simple thing, I've just not had to deal with it before and can't seem to find a way to fix it.

I have a userform that has a textbox. When the form is activated, the textbox is filled with a ten-line-long string variable, with horizontal scrollbars in case the line is too long for the textbox. Most of the time it probably will be too long, and that's fine with me (wordwrap is off). However, if the 10th line is longer than the textbox itself, the scrollbars are all the way to the right, as the cursor in the textbox is blinking at the end of the scrollbar.

I've got the textbox locked, so no one can add anything to it, is there a way to either default the blinking cursor to be at the beginning of the textbox, or even remove the cursor at all? I'm using a textbox so I can have the horizontal scroll, if theres a better way to accomplish what I need to do I'd love to hear it.

Thanks!
Matt

Zack Barresse
08-24-2004, 08:53 AM
Hey Matt,

Untested as of yet, but maybe something like ...


If TextBox1.ListCount > 0 Then TextBox1.ListIndex = 1

... at the end of the initialize event. (??)

mvidas
08-24-2004, 09:23 AM
That's a good idea, but for the textbox in the userform those aren't valid properties. I tried using textbox1.linecount, but that just causes an error in the sub

I just tried two things and seem to have fixed the error. I changed the SelStart property to zero, and set the default property to one of the commandbuttons to true. Apparently non had default=true, so the textbox was the default (even though it has no default property). I'm not sure which of the two changes I just made fixed it, but it seems to have done the trick.

Thanks! Without your suggestion I probably wouldn't have tried SelStart (as it's not in the properties window, only in the dropdown after entering the textboxname and the dot). I'm sure I'll be posting another Q today, having issues with this userform (after lunch though)