List width???

Mermogoat

Registered User.
Local time
Today, 06:36
Joined
Dec 1, 2002
Messages
36
In VB, I try to set the ListWidth property of a combo box to a certain value, and I want it in inches. I have

Me![comboBox].ListWidth = "1.125 in" and I get the "must be a number error, but if i dont include the ' in' it uses the wrong measurement. What do I need to do to tell it INCHES...Is there an escape character when using strings in VB so you can have a " in it...i know in other languages you can have String = "blah \"blah\" blah" to have the string

blah "blah" blah

but can you do that in VB? I tried \ but it didn't work
Thanks
 
Look up listwidth in VB help. Half way down it states:

In Visual Basic, use a numeric expression to set the value of this property. The default unit of measurement in Visual Basic is twips.

So as Rich posted above, the list width is 5300 "twips" (What ever they are, not important) just play with the number until you get the width your after.
HTH
Dave
 
Yes, I read that. But it says to specify as inches if you want it to be inches...So it said to say put "1.125 in " for the measurement....I get an error when I do that, but when I do it for anything else, like a column width, it works fine.
 
My mistake, you are talking about a list width in a combo box.
Will have to investigate further.
Dave
 
I put this code on a temorary button on a form, seemed to work

Me.Combo2.ColumnWidths = "200;1100;300" '- twips
or
Me.Combo2.ColumnWidths = "1cm;1cm;3cm" '- metric
or
Me.Combo2.ColumnWidths = "0.5in;1in;3in" '-imperial

All three examples seemed to work

Good luck
Dave
 
I dont understand, where is the listwidth you cant set ?

Me.Combo47.ListWidth = 6000 ' - twips
Me.Combo47.ColumnWidths = "2000;4000" '- twips

The only thing I can think of is that you are not setting the list width wider than the combo box, thus it defaults to the combo box size. Try with some realy big numbers and work backwards maybe
Dave
 
I think mermogoat's complaint is that He/She can't set the ListWidth in inches, I don't see that it matters since you can use Twips. Don't take everything in the Help file as Gospel
 

Users who are viewing this thread

Back
Top Bottom