Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get items in ListView in columns

Using Excel XP.
Does anybody have a simple example of how to get items (short strings) in a
ListView control in columns?
It has to be added in a loop like this:
Add item in column 1
Add item in column 2
Add item in column 3
Add item in column 1
etc.
Seems a simple thing, but I can't get it to work.
Thanks for any assistance.

RBS

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get items in ListView in columns

Let me be a bit more specific.
This is the relevant code bits to do with the ListView:

With ListView1
.HideColumnHeaders = False
.HideSelection = False
.LabelEdit = lvwManual
.Sorted = False
.TextBackground = lvwOpaque
.FullRowSelect = True
.View = lvwReport
End With

With ListView1
.ListItems.Add i, , hwnd
.ListItems(i).ListSubItems.Add , , sClassname
.ListItems(i).ListSubItems.Add , , sWindowText
End With

On testing (msgbox, ListView1.ListItems.Count) all seems to be working fine,
but nothing shows in the ListView.
I can't even get column header to show, although the grey column shows on
the top.
I am talking here about the Microsoft ListView Control 6.0 (SP6) in VBA.
I am just puzzeled by this and would greatly appreciate any advice.



RBS




"RB Smissaert" wrote in message
...
Using Excel XP.
Does anybody have a simple example of how to get items (short strings) in

a
ListView control in columns?
It has to be added in a loop like this:
Add item in column 1
Add item in column 2
Add item in column 3
Add item in column 1
etc.
Seems a simple thing, but I can't get it to work.
Thanks for any assistance.

RBS


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get items in ListView in columns

Still no luck with this.
I replaced the file mscomctl.ocx with a new one, although I had the latest
version (6.1.95.45), but it made no difference.
Tried all sorts of different syntaxes like:

Dim itmX As ListItem

Set itmX = ListView1.ListItems.Add

itmX.Text = hwnd
itmX.ListSubItems.Add , , sClassname
itmX.ListSubItems.Add , , sWindowText


Still nothing shows in the ListView.
Really mysified by this.


RBS


"RB Smissaert" wrote in message
...
Using Excel XP.
Does anybody have a simple example of how to get items (short strings) in

a
ListView control in columns?
It has to be added in a loop like this:
Add item in column 1
Add item in column 2
Add item in column 3
Add item in column 1
etc.
Seems a simple thing, but I can't get it to work.
Thanks for any assistance.

RBS


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get items in ListView in columns

Done some testing with a ListView in it's simplest form.
Opened a new workbook.
Added a form.
Added a ListView, called ListView1
Added a code module with the following code:

Sub LoadUserForm()

Load UserForm1
UserForm1.Show

With UserForm1.ListView1
.View = lvwReport
.Appearance = ccFlat
.Enabled = True
.FullRowSelect = False
.Gridlines = True
.HideSelection = False
.LabelEdit = lvwManual
End With

Dim itmX As ListItem

Set itmX = UserForm1.ListView1.ListItems.Add

itmX.Text = "item1"
itmX.ListSubItems.Add , , "item2"
itmX.ListSubItems.Add , , "item3"

End Sub

Now sometimes this shows item1 and sometimes no items.
Item 2 and 3 never show.
Clearly something is corrupted here.
Think I might have to reinstall Excel.


RBS

"RB Smissaert" wrote in message
...
Using Excel XP.
Does anybody have a simple example of how to get items (short strings) in

a
ListView control in columns?
It has to be added in a loop like this:
Add item in column 1
Add item in column 2
Add item in column 3
Add item in column 1
etc.
Seems a simple thing, but I can't get it to work.
Thanks for any assistance.

RBS


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
line up items in column a with items in columns b, c, etc meera123 Excel Discussion (Misc queries) 0 September 2nd 08 02:20 PM
Adding items to columns in a listbox Daniel Bonallack Excel Discussion (Misc queries) 1 May 7th 07 04:45 PM
I cannot see some columns and some menu items are grayed out LORI ROBINSON Excel Discussion (Misc queries) 3 September 20th 06 05:10 PM
Sort and Match like Items in 2 Columns blaylock Excel Worksheet Functions 2 July 26th 06 09:32 PM
Description of Listview and Treeview Controls Frank[_12_] Excel Programming 1 August 14th 03 08:40 AM


All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"