Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Microsoft Listview Control 6.0 (SP4)

43 views
Skip to first unread message

Paradise Account

unread,
Nov 26, 2001, 4:11:23 PM11/26/01
to
Hi

I am using the MS Listview control 6.0 on a form. I have named it listview1.

To this (see code below) I have added one column with 5 rows in it.

When I load up my form, I want to multiselect blue, green and orange, so I
hold down the Shift key and click on orange. What is selected turns out to
be orange, pink and yellow.

I think this happens because yellow was the first item to be added and some
sort of an index set to 1 so it is the first to be selected although the
selected =.f.

My question is how do I select blue, green and orange. Any help is
appreciated.

Thanks

* This code goes in the Init()
* Add one column to the listview
Thisform.ListView1.ColumnHeaders.Add(, , 'Name', 165)

* Clear Listbox
Thisform.ListView1.ListItems.Clear()

* Manual Editing
Thisform.ListView1.LabelEdit=1

* Display Items in Report mode like Windows Explorer
Thisform.ListView1.view=3

* Turn on multiselect
thisform.listView1.multiSelect=.t.

* Turn Sorting off
Thisform.ListView1.Sorted=.f.

Thisform.ListView1.ListItems.Add(1 , , 'Yellow', ,) && Column 1
Thisform.ListView1.ListItems.Add(1 , , 'Blue', ,) && Column 2
Thisform.ListView1.ListItems.Add(1 , , 'Green', ,) && Column 3
Thisform.ListView1.ListItems.Add(1 , , 'Pink', ,) && Column 4
Thisform.ListView1.ListItems.Add(1 , , 'orange', ,) && Column 5

* Deselect the selected item
Thisform.ListView1.Selecteditem.Selected=.f.

* Turn sorting back on
thisform.listView1.sorted=.t.

* Select the first item in the list.
Thisform.ListView1.ListItems(1).Selected()
Thisform.listview1.ListItems(1).selected=.t.

Frank Dietrich

unread,
Nov 27, 2001, 3:39:27 AM11/27/01
to
>
>
>My question is how do I select blue, green and orange. Any help is
>appreciated.
>
>
>* Select the first item in the list.
>Thisform.ListView1.ListItems(1).Selected()
>Thisform.listview1.ListItems(1).selected=.t.


I am not quite sure how the listView behaves but most controls
start to count at 0
So try Thisform.ListView1.ListItems(0).Selected()

If it's not working You'll get an error
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.D...@dd-tech.de
DFPUG # 327

Danny

unread,
Nov 27, 2001, 4:54:03 AM11/27/01
to
Frank, listview is special it does not start at 0 but 1. Listview is
comprised by listitems (records) and columnheaders.

Danny

Frank Dietrich

unread,
Nov 27, 2001, 5:24:31 AM11/27/01
to
On Tue, 27 Nov 2001 17:54:03 +0800, Danny <sb...@pd.jaring.my> wrote:

>Frank, listview is special it does not start at 0 but 1. Listview is
>comprised by listitems (records) and columnheaders.

Sorry, was just an idea. Normally I don't use it

Danny

unread,
Nov 27, 2001, 8:33:00 AM11/27/01
to
Frank no harm trying :)

Danny

Elmbrook

unread,
Nov 27, 2001, 3:04:51 PM11/27/01
to
Thanks for the idea but does anyone have any other ideas???


"Danny" <sb...@pd.jaring.my> wrote in message
news:3C03960B...@pd.jaring.my...

Danny

unread,
Nov 28, 2001, 10:29:57 AM11/28/01
to
Hi, i'm not actually quite understand what's your question could you repeat ?

Danny

Igor Korolyov

unread,
Dec 4, 2001, 1:05:01 PM12/4/01
to
Try this code:

Thisform.ListView1.ListItems.Add(1 , , 'Yellow', ,) && Column 1
Thisform.ListView1.ListItems.Add(1 , , 'Blue', ,) && Column 2
Thisform.ListView1.ListItems.Add(1 , , 'Green', ,) && Column 3
Thisform.ListView1.ListItems.Add(1 , , 'Pink', ,) && Column 4
Thisform.ListView1.ListItems.Add(1 , , 'orange', ,) && Column 5

Thisform.ListView1.SelectedItem = Thisform.ListView1.ListItems(2)
Thisform.listview1.ListItems(1).selected=.f.
Thisform.listview1.ListItems(2).selected=.t.
Thisform.listview1.ListItems(3).selected=.t.
Thisform.listview1.ListItems(4).selected=.t.

WBR, Igor


0 new messages