-
August 26th, 2023, 11:15 AM
#1
want 2 columns but getting 3
Hi, I would use a flexgrid but VB6 (enterprise) says it's not registered (even though it's there in the list, with its check box ticked) so I have used a list box (simple dropdown list) instead, which is perfectly adequate, apart from...
At design time I set the number of columns at 2.
At runtime however I currently get 3 columns - with a horizontal scrollbar added. I think that scroller may be the problem, but I cant see how to get rid of it, since there's no reference to it in the properties window. The list is simple and static, and I load it in form_load as follows (all items follow this model, all have 3 letters. They are constellation abbreviations):
Code:
With ddConstells
.Width = 1935
.AddItem "And"
.AddItem "Aqr"
.AddItem "Aql"
.AddItem "Ari"
.AddItem "Aur"
.AddItem "Boo"
.AddItem "Cam"
.AddItem "Cnc"
End With
Anyone come to the aid of this damnfool in distress? ;-)
-
August 29th, 2023, 07:41 AM
#2
Re: want 2 columns but getting 3
The problem is that you are setting the width of the listbox to 1935 pixels. This is wider than the width of two columns, so a third column is added to accommodate the extra text. To fix this, you can either reduce the width of the listbox or set the MultiColumn property to False. Have a look here
Last edited by smylit45; September 29th, 2023 at 06:45 AM.
-
August 29th, 2023, 08:13 AM
#3
Re: want 2 columns but getting 3
 Originally Posted by smylit45
The problem is that you are setting the width of the listbox to 1935 pixels. This is wider than the width of two columns, so a third column is added to accommodate the extra text. To fix this, you can either reduce the width of the listbox or set the MultiColumn property to False.
Okay... I removed the '1' from the width, so that made the new width 935 (I thought the number here was in twips, not pixels. Clearly 1935 pixels is enormous for a dropdown box!) It obviously was twips, because this time the width is about half what it was - but I still get three columns and a horizontal scrollbar.
I don't want to set the multicolumn to false because I want a multi column box. (well, 2 columns anyway)
-
August 29th, 2023, 02:24 PM
#4
Re: want 2 columns but getting 3
It is not clear whether you mean a ListBox or ListCtrl.
Also some code snippets would help to understand your problem.
Victor Nijegorodov
-
August 30th, 2023, 10:37 AM
#5
Re: want 2 columns but getting 3
 Originally Posted by VictorN
It is not clear whether you mean a ListBox or ListCtrl.
Also some code snippets would help to understand your problem. 
Thanks Victor,dd
It's a simple listbox (dropdown box) called ddConstells - actually the only code is what I originally posted. The problem seems to be what VB does with it.
In the properties window at design time I set its columns to 2. But at run time I get (so far) 3 columns plus a horizontal scrollbar! That scrollbar seems to be there purely because there are now 3 columns. I do however want a vertical scrollbar but that isn't there! So... where do those scrollbars come from, and how can I control them?
-
August 31st, 2023, 05:35 AM
#6
Re: want 2 columns but getting 3
[@babystarman - you might get further help on this site's sister site https://www.vbforums.com/forumdispla...-6-and-Earlier which is more active]
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 31st, 2023, 08:44 AM
#7
Re: want 2 columns but getting 3
 Originally Posted by 2kaud
Many thanks - I shall give that a try!
-
September 22nd, 2023, 03:45 AM
#8
Re: want 2 columns but getting 3
Have you found a solution?
-
September 26th, 2023, 06:25 AM
#9
Re: want 2 columns but getting 3
 Originally Posted by smylit45
Have you found a solution?
Nope! But actually I have had an idea, to rewrite the code on my laptop, where everything is working as it should! So, end of problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|