|
-
Apr 12th, 2011, 05:25 PM
#1
Thread Starter
Lively Member
[RESOLVED] Actions of list box
I posted this situation once before and thought I had it taken care of but find I still have the problem.
I have created a ListBox (lstModels) with properties of:
Sorted = False
Columns = 2
MultiSelect = 0
Style = 1 - Checkbox
In the Form Load procedure I enter 16 entries. The first entry is for selecting "All Models." The height of the list box allows 10 entries before spililing over to the next column. When displayed the list box always Appears to have 3 columns always with a horizontal slider shown.
If I check on any entry in column 1 the check box is checked. If I select the "All models" entry the sub-routine is called that checks all entries. If i clink on the "All models" when that have been previously all been checked all are unchecked. So far, so good.
If I check ANY entry in column 2 the following happens. The entry does not show that it has been checked, all remaining entries in column 2 no longer show the check boxes (except the one that was clicked on), and the entire list box shifts to the right to display the "3 rd" column (column1 is no longer visible).
The only procedure in the module that involves the list box is the following.
Private Sub lstModels_Click()
Dim N As Integer
' if all models was click and all not currently selected then set on all model
' in the list
If lstModels.Selected(0) = True And mCurrAll <> 1 Then
For N = 1 To lstModels.ListCount - 1
lstModels.Selected(N) = True
Next N
' set modular flag to indicate that all was previously selected
mCurrAll = 1
' if all models was set to off and all models had been selected then set all
' to off
ElseIf lstModels.Selected(0) = False And mCurrAll = 1 Then
For N = 1 To lstModels.ListCount - 1
lstModels.Selected(N) = False
Next N
mCurrAll = 0
End If
End Sub
I have tried many many times to adjust the width oif the list box thinging thgat that might be causing the "extra" column but have not been able to make it appear as I think it should "2 columns"
Any suggestions on what could be causing this would be geratly appreciated.
Marv
-
Apr 12th, 2011, 06:12 PM
#2
Re: Actions of list box
Set IntegralHeight to False, adjust height and width of listbox.
The horizontal scroolbar should't appears.
-
Apr 12th, 2011, 06:28 PM
#3
Re: Actions of list box
You'd be better off using a Listview rather than a multi-column Listbox.
-
Apr 13th, 2011, 09:50 AM
#4
Re: Actions of list box
Listboxes in VB6 do not support multi columns. THe Listbox in VB6 and earlier is a single column control.
Listboxes available in Office development using VBA, however, do support multiple columns. Are you sure you are using VB6 for this project?
-
Apr 13th, 2011, 10:36 AM
#5
Re: Actions of list box
 Originally Posted by Hack
Listboxes in VB6 do not support multi columns. THe Listbox in VB6 and earlier is a single column control.
Listboxes available in Office development using VBA, however, do support multiple columns. Are you sure you are using VB6 for this project?
Hmmm, Hack, my VB6 release supports two-column list boxes. It behaves rather goofy, but it does support two columns or more. 
I usually forget that feature and use a non-proportional font and tabs or spaces to show lined-up columns of variables.
-
Apr 13th, 2011, 10:48 AM
#6
Re: Actions of list box
Ok, I will admit "does not support" might have been a bit inaccurate. However, funtionally speaking, I would stand by that.
The Columns property of the listbox enables you to, for lack of a better term, "wiggle" the items in the list, i.e. take your list of items and show them in newspaper like columns. But it is easier to pass a camel through the eye of a needle than it is to actually use the columns as individual data entities. Clearly the VBA teams at Microsoft were not on close speaking terms with the VB teams at Microsoft when it came to building this control.
-
Apr 13th, 2011, 01:14 PM
#7
Thread Starter
Lively Member
Re: Actions of list box
 Originally Posted by gibra
Set IntegralHeight to False, adjust height and width of listbox.
The horizontal scroolbar should't appears.
Thanks for the response. Setting the IntegralHeight to flase did eliminate the extra space to the right of the data displayed. However, it causes another situation to occur. The data in column 2 now overlaps the data in column 1. I haven't been able to determine if there is any means to avoid this. I have adjusted the length of entries but this does not change the column widht. I can't find a property that would determine the widths of the column or determine what does actuallly determine this. Modifing the width of the list box doesn't seem to change anything.
It has been suggested that I should use a listview instead, but from what I read I don't see how this would do what I am trying to do. The multiple columns is not to display additional data for an entry, it is simply because the height of the list box cannot be greater than the number of entries, so it overflows in newspaper style.
-
Apr 13th, 2011, 02:32 PM
#8
Re: [RESOLVED] Actions of list box
Why do you have Columns = 2 if you don't have additional data to display?
-
Apr 13th, 2011, 04:42 PM
#9
Re: Actions of list box
 Originally Posted by Hack
Ok, I will admit "does not support" might have been a bit inaccurate. However, funtionally speaking, I would stand by that.
The Columns property of the listbox enables you to, for lack of a better term, "wiggle" the items in the list, i.e. take your list of items and show them in newspaper like columns. But it is easier to pass a camel through the eye of a needle than it is to actually use the columns as individual data entities. Clearly the VBA teams at Microsoft were not on close speaking terms with the VB teams at Microsoft when it came to building this control.
+1.
I doubt I could have said it any better than that, and that's precisely why I never released any software with a multi-column list box. My tech support people would have assassinated their boss.
-
Apr 13th, 2011, 05:08 PM
#10
Re: [RESOLVED] Actions of list box
@marv: Out of curiosity what did you do to fix it?
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
|