PC Review


Reply
Thread Tools Rate Thread

Appearance of listboxes

 
 
Hank Youngerman
Guest
Posts: n/a
 
      14th Nov 2006
I have a UserForm with two listboxes on it. Each listbox is populated
with about 4-8 numbers of 2 or 3 digits. Each listbox is wide enough
for about 4 numbers, and high enough for two rows.

When I load the form, the boxes appear with both horizontal and
vertical scroll bars, and I can see two numbers in the boxes, one on
top of the other. The two-digit numbers appear fine, but the
three-digit numbers are aligned such that the right-most number is
partially cut off. For both boxes, the TextAlign property is set to
fmTextAlignLeft. If I change the TextAlign property (to center or
right) the contents disappear, and I have to scroll to the right to see
it.

I populate the boxes with the additem method, specifically:

UserForm1.Radius.AddItem 8
UserForm1.Radius.AddItem 10
UserForm1.Radius.AddItem 100

What appears to be happening is that the control interprets these as
being about 8-10 characters wide. If I widen the listboxes, the scroll
bars go away. But none of the values are greater than 3 digits.

So my first question is, how do I get the listboxes to recognize that
these are just 3-digit numbers, and get it to accomodate a narrow
listbox without scroll bars?

With regard to vertical appearance, I want it to be something like a
dropdown box. What I have now is more like a text window with vertical
scroll bars. Am I just using the wrong kind of control for this?

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      14th Nov 2006
Width question, set the Columnwidths property.

And yes, it seems you want a Combobox, not a Listbox.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Hank Youngerman" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a UserForm with two listboxes on it. Each listbox is populated
> with about 4-8 numbers of 2 or 3 digits. Each listbox is wide enough
> for about 4 numbers, and high enough for two rows.
>
> When I load the form, the boxes appear with both horizontal and
> vertical scroll bars, and I can see two numbers in the boxes, one on
> top of the other. The two-digit numbers appear fine, but the
> three-digit numbers are aligned such that the right-most number is
> partially cut off. For both boxes, the TextAlign property is set to
> fmTextAlignLeft. If I change the TextAlign property (to center or
> right) the contents disappear, and I have to scroll to the right to see
> it.
>
> I populate the boxes with the additem method, specifically:
>
> UserForm1.Radius.AddItem 8
> UserForm1.Radius.AddItem 10
> UserForm1.Radius.AddItem 100
>
> What appears to be happening is that the control interprets these as
> being about 8-10 characters wide. If I widen the listboxes, the scroll
> bars go away. But none of the values are greater than 3 digits.
>
> So my first question is, how do I get the listboxes to recognize that
> these are just 3-digit numbers, and get it to accomodate a narrow
> listbox without scroll bars?
>
> With regard to vertical appearance, I want it to be something like a
> dropdown box. What I have now is more like a text window with vertical
> scroll bars. Am I just using the wrong kind of control for this?
>



 
Reply With Quote
 
=?Utf-8?B?RGF2ZSBSYW1hZ2U=?=
Guest
Posts: n/a
 
      14th Nov 2006
Hank,

This is indeed strange behaviour, but seems to be fixed by setting the
ColumnWidth property to something small (e.g. 2).

It does sound like you really want a combobox though, which would only show
the selected value in a single row, or the complete/partial list if the user
clicks the expand arrow. Set the combo box parameter "Style" to
fmStyleDropDownList if you don't want the user to be able to type in values
that aren't in the list.

Cheers,
Dave

"Hank Youngerman" wrote:

> I have a UserForm with two listboxes on it. Each listbox is populated
> with about 4-8 numbers of 2 or 3 digits. Each listbox is wide enough
> for about 4 numbers, and high enough for two rows.
>
> When I load the form, the boxes appear with both horizontal and
> vertical scroll bars, and I can see two numbers in the boxes, one on
> top of the other. The two-digit numbers appear fine, but the
> three-digit numbers are aligned such that the right-most number is
> partially cut off. For both boxes, the TextAlign property is set to
> fmTextAlignLeft. If I change the TextAlign property (to center or
> right) the contents disappear, and I have to scroll to the right to see
> it.
>
> I populate the boxes with the additem method, specifically:
>
> UserForm1.Radius.AddItem 8
> UserForm1.Radius.AddItem 10
> UserForm1.Radius.AddItem 100
>
> What appears to be happening is that the control interprets these as
> being about 8-10 characters wide. If I widen the listboxes, the scroll
> bars go away. But none of the values are greater than 3 digits.
>
> So my first question is, how do I get the listboxes to recognize that
> these are just 3-digit numbers, and get it to accomodate a narrow
> listbox without scroll bars?
>
> With regard to vertical appearance, I want it to be something like a
> dropdown box. What I have now is more like a text window with vertical
> scroll bars. Am I just using the wrong kind of control for this?
>
>

 
Reply With Quote
 
Hank Youngerman
Guest
Posts: n/a
 
      14th Nov 2006
Thanks to both who replied. I have already made the changes in the
ColumnWidth property. I hadn't realized that you could set a property
on a combo box to prevent a user from typing in a value, so I will work
with that also.




Dave Ramage wrote:
> Hank,
>
> This is indeed strange behaviour, but seems to be fixed by setting the
> ColumnWidth property to something small (e.g. 2).
>
> It does sound like you really want a combobox though, which would only show
> the selected value in a single row, or the complete/partial list if the user
> clicks the expand arrow. Set the combo box parameter "Style" to
> fmStyleDropDownList if you don't want the user to be able to type in values
> that aren't in the list.
>
> Cheers,
> Dave
>
> "Hank Youngerman" wrote:
>
> > I have a UserForm with two listboxes on it. Each listbox is populated
> > with about 4-8 numbers of 2 or 3 digits. Each listbox is wide enough
> > for about 4 numbers, and high enough for two rows.
> >
> > When I load the form, the boxes appear with both horizontal and
> > vertical scroll bars, and I can see two numbers in the boxes, one on
> > top of the other. The two-digit numbers appear fine, but the
> > three-digit numbers are aligned such that the right-most number is
> > partially cut off. For both boxes, the TextAlign property is set to
> > fmTextAlignLeft. If I change the TextAlign property (to center or
> > right) the contents disappear, and I have to scroll to the right to see
> > it.
> >
> > I populate the boxes with the additem method, specifically:
> >
> > UserForm1.Radius.AddItem 8
> > UserForm1.Radius.AddItem 10
> > UserForm1.Radius.AddItem 100
> >
> > What appears to be happening is that the control interprets these as
> > being about 8-10 characters wide. If I widen the listboxes, the scroll
> > bars go away. But none of the values are greater than 3 digits.
> >
> > So my first question is, how do I get the listboxes to recognize that
> > these are just 3-digit numbers, and get it to accomodate a narrow
> > listbox without scroll bars?
> >
> > With regard to vertical appearance, I want it to be something like a
> > dropdown box. What I have now is more like a text window with vertical
> > scroll bars. Am I just using the wrong kind of control for this?
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listboxes C Brehm Microsoft Excel Programming 4 9th Jan 2008 03:11 PM
2 Listboxes DS Microsoft Access Form Coding 0 7th Jul 2006 08:26 PM
wmf appearance or non-appearance in Outline view =?Utf-8?B?eHBwdXNlcg==?= Microsoft Word Document Management 1 24th Apr 2006 05:23 PM
listboxes john.9.williams@bt.com Microsoft Excel Programming 2 22nd Feb 2005 10:31 AM
windows appearance changes automatically to another appearance =?Utf-8?B?YW5kaQ==?= Windows XP Help 0 23rd Sep 2004 11:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:49 PM.