List box columns are killing me

List box columns are killing me

Anonymous
Not applicable
346 Views
7 Replies
Message 1 of 8

List box columns are killing me

Anonymous
Not applicable
This should be really basic, but I want to populate a list box that has two
columns. I know you can feed an array into it using .List but I want/need to
feed the items into each column one at a time and .AddItem seems to give me
fits. Help?!

Thanks,

Ben Rand
0 Likes
347 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Two words: ListView (ok, maybe one)

The ListView control in Report format will let you add any
number of columns. Every column beyond the first can be
filled with the SubItems collection of the ListItem class:

Dim tmp As ListItem

Set tmp = myListView.ListItems.Add , , "A new item"
tmp.SubItems(1) = "Additional info"

--
http://www.acadx.com

"Ben Rand" wrote in message
news:6445AE43BE298E2C240D051D6E66E995@in.WebX.maYIadrTaRb...
> This should be really basic, but I want to populate a list
box that has two
> columns. I know you can feed an array into it using .List
but I want/need to
> feed the items into each column one at a time and .AddItem
seems to give me
> fits. Help?!
>
> Thanks,
>
> Ben Rand
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
If you are writing your app in VBA you don't have a license to use ListView
or TreeView
or a whole lot of other controls for that matter.

Joe

"Frank Oquendo" wrote in message
news:54DDAD9980EA19C15ADCDAFA2A9A7256@in.WebX.maYIadrTaRb...
> Two words: ListView (ok, maybe one)
>
> The ListView control in Report format will let you add any
> number of columns. Every column beyond the first can be
> filled with the SubItems collection of the ListItem class:
>
> Dim tmp As ListItem
>
> Set tmp = myListView.ListItems.Add , , "A new item"
> tmp.SubItems(1) = "Additional info"
>
> --
> http://www.acadx.com
>
> "Ben Rand" wrote in message
> news:6445AE43BE298E2C240D051D6E66E995@in.WebX.maYIadrTaRb...
> > This should be really basic, but I want to populate a list
> box that has two
> > columns. I know you can feed an array into it using .List
> but I want/need to
> > feed the items into each column one at a time and .AddItem
> seems to give me
> > fits. Help?!
> >
> > Thanks,
> >
> > Ben Rand
> >
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
I have not had any problems using ListView, TreeView etc... from vbA. The
only unlicensed control I have come across is the common dialog control.

JD

Joe Sutphin wrote in message
news:210831971345B956166FC6C4BBE5CC58@in.WebX.maYIadrTaRb...
If you are writing your app in VBA you don't have a license to use ListView
or TreeView
or a whole lot of other controls for that matter.

Joe

"Frank Oquendo" wrote in message
news:54DDAD9980EA19C15ADCDAFA2A9A7256@in.WebX.maYIadrTaRb...
> Two words: ListView (ok, maybe one)
>
> The ListView control in Report format will let you add any
> number of columns. Every column beyond the first can be
> filled with the SubItems collection of the ListItem class:
>
> Dim tmp As ListItem
>
> Set tmp = myListView.ListItems.Add , , "A new item"
> tmp.SubItems(1) = "Additional info"
>
> --
> http://www.acadx.com
>
> "Ben Rand" wrote in message
> news:6445AE43BE298E2C240D051D6E66E995@in.WebX.maYIadrTaRb...
> > This should be really basic, but I want to populate a list
> box that has two
> > columns. I know you can feed an array into it using .List
> but I want/need to
> > feed the items into each column one at a time and .AddItem
> seems to give me
> > fits. Help?!
> >
> > Thanks,
> >
> > Ben Rand
> >
>
0 Likes
Message 5 of 8

Anonymous
Not applicable
If I can tap in on this thread, I am having trouble figuring out if I can and how I can
populate the column Heads of a listbox. The help file doesn't seem to say much.

--
Kent

"Ben Rand" wrote in message
news:6445AE43BE298E2C240D051D6E66E995@in.WebX.maYIadrTaRb...
> This should be really basic, but I want to populate a list box that has two
> columns. I know you can feed an array into it using .List but I want/need to
> feed the items into each column one at a time and .AddItem seems to give me
> fits. Help?!
>
> Thanks,
>
> Ben Rand
>
0 Likes
Message 6 of 8

Anonymous
Not applicable
Follow up on suggestions...

Frank and Jacob, I did go ahead with the ListView control which worked very
well (has a TON of great capabilities the VBA list box doesn't have) after I
stumbled around with it for a few hours trying to figure out how it worked.
I still don't understand why you can't just reference a particular
row,column in a regular list box and stick a value in there rather than
having to deal with an array. I'm trying to read delimited data out of a
.txt file which is then split up and put into columns in the list box. It
feels like I'm taking the long route by reading the info in, parsing it (to
split it into components), adding the parsed data into separate arrays, then
combining the arrays, THEN feeding it into the list box.

Joe and I exchanged an email or two behind everyone's back 🙂 but he did
reaffirm his statement about license to use that particular control in VBA.
Forgive me Joe, but I don't fully understand the implications--or how/if
that particular control would have to be licensed in order to be used. Maybe
others understand that better than I do, but I wouldn't mind more
explanation about this.

I do have a licensed VB Pro edition but usually develop my AutoCAD stuff in
VBA. Again, I don't really know if that's here or there.

Thanks for the input.

Ben Rand

"Ben Rand" wrote in message
news:6445AE43BE298E2C240D051D6E66E995@in.WebX.maYIadrTaRb...
> This should be really basic, but I want to populate a list box that has
two
> columns. I know you can feed an array into it using .List but I want/need
to
> feed the items into each column one at a time and .AddItem seems to give
me
> fits. Help?!
>
> Thanks,
>
> Ben Rand
>
0 Likes
Message 7 of 8

Anonymous
Not applicable
> but he did reaffirm his statement about license
> to use that particular control in VBA.

For corporate development, you can safely ignore this issue
since you have the ability to control the target
environment. All you would need to do is distribute the VB
runtimes and any third-party components for non-development
machines to be able to use any of your legally licensed
controls.

--
http://www.acadx.com
0 Likes
Message 8 of 8

Anonymous
Not applicable
Why can't you reference a column and row? Who knows... There are some things
you just have to accept, listboxes can only take arrays for multi-column
use, hence the suggestion of the list view. Besides it has a some great
features as you mentioned.

JD

Ben Rand wrote in message
news:DCD53163CD86CC0410263942DF20BE09@in.WebX.maYIadrTaRb...
Follow up on suggestions...

Frank and Jacob, I did go ahead with the ListView control which worked very
well (has a TON of great capabilities the VBA list box doesn't have) after I
stumbled around with it for a few hours trying to figure out how it worked.
I still don't understand why you can't just reference a particular
row,column in a regular list box and stick a value in there rather than
having to deal with an array. I'm trying to read delimited data out of a
.txt file which is then split up and put into columns in the list box. It
feels like I'm taking the long route by reading the info in, parsing it (to
split it into components), adding the parsed data into separate arrays, then
combining the arrays, THEN feeding it into the list box.

Joe and I exchanged an email or two behind everyone's back 🙂 but he did
reaffirm his statement about license to use that particular control in VBA.
Forgive me Joe, but I don't fully understand the implications--or how/if
that particular control would have to be licensed in order to be used. Maybe
others understand that better than I do, but I wouldn't mind more
explanation about this.

I do have a licensed VB Pro edition but usually develop my AutoCAD stuff in
VBA. Again, I don't really know if that's here or there.

Thanks for the input.

Ben Rand

"Ben Rand" wrote in message
news:6445AE43BE298E2C240D051D6E66E995@in.WebX.maYIadrTaRb...
> This should be really basic, but I want to populate a list box that has
two
> columns. I know you can feed an array into it using .List but I want/need
to
> feed the items into each column one at a time and .AddItem seems to give
me
> fits. Help?!
>
> Thanks,
>
> Ben Rand
>
0 Likes