ListView 
Author Message
 ListView

Can the ListView be used to display  rows of data with a checkbox on each
row and an invisible column?  I see a Columns collection but cannot find an
example showing how to populate the control with data.

[  ]     Dog           Canine           Carnivore
[  ]     Cat             Feline           Carnivore
[x]     Cow          Bovine           Herbivore
[  ]     Horse         Equine           Herbivore

TIA
Tim



Tue, 08 Feb 2005 02:20:35 GMT  
 ListView
Are you trying to do something like this...

    Dim ch0, ch1, ch2, ch3 As System.Windows.Forms.ColumnHeader
    Dim i As System.Windows.Forms.ListViewItem
    ch0 = New System.Windows.Forms.ColumnHeader()
    ch1 = New System.Windows.Forms.ColumnHeader()
    ch2 = New System.Windows.Forms.ColumnHeader()
    ch3 = New System.Windows.Forms.ColumnHeader()
    ch0.Text = " "
    ch1.Text = "Name"
    ch2.Text = "Species"
    ch3.Text = "Diet"
    ch0.Width = 20
    ListView1.CheckBoxes = True
    ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {ch0,
ch1, ch2, ch3})
    ListView1.Location = New System.Drawing.Point(16, 24)
    ListView1.View = System.Windows.Forms.View.Details

    i = New System.Windows.Forms.ListViewItem()
    i.Text = ""
    i.SubItems.Add("Dog")
    i.SubItems.Add("Canine")
    i.SubItems.Add("Carnivore")
    ListView1.Items.Add(i)

Mike Pietraszak
Microsoft Visual Studio .NET Team
--
This posting is provided "AS IS" with no warranties, and confers no rights.
(c) copyright Microsoft Corporation 2002


Quote:
> Can the ListView be used to display  rows of data with a checkbox on each
> row and an invisible column?  I see a Columns collection but cannot find
an
> example showing how to populate the control with data.

> [  ]     Dog           Canine           Carnivore
> [  ]     Cat             Feline           Carnivore
> [x]     Cow          Bovine           Herbivore
> [  ]     Horse         Equine           Herbivore

> TIA
> Tim



Wed, 09 Feb 2005 06:55:36 GMT  
 ListView
Thank you for this helpful code. It sheds light on some of the things I was
trying to do. In addition to having no caption in the column header, I was
hoping to make the data in one of the columns, e.g. SpeciesIdNumber,
invisible. Can columns be hidden?
Tim



Quote:
> Are you trying to do something like this...

>     Dim ch0, ch1, ch2, ch3 As System.Windows.Forms.ColumnHeader
>     Dim i As System.Windows.Forms.ListViewItem
>     ch0 = New System.Windows.Forms.ColumnHeader()
>     ch1 = New System.Windows.Forms.ColumnHeader()
>     ch2 = New System.Windows.Forms.ColumnHeader()
>     ch3 = New System.Windows.Forms.ColumnHeader()
>     ch0.Text = " "
>     ch1.Text = "Name"
>     ch2.Text = "Species"
>     ch3.Text = "Diet"
>     ch0.Width = 20
>     ListView1.CheckBoxes = True
>     ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader()
{ch0,
> ch1, ch2, ch3})
>     ListView1.Location = New System.Drawing.Point(16, 24)
>     ListView1.View = System.Windows.Forms.View.Details

>     i = New System.Windows.Forms.ListViewItem()
>     i.Text = ""
>     i.SubItems.Add("Dog")
>     i.SubItems.Add("Canine")
>     i.SubItems.Add("Carnivore")
>     ListView1.Items.Add(i)

> Mike Pietraszak
> Microsoft Visual Studio .NET Team
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> (c) copyright Microsoft Corporation 2002



> > Can the ListView be used to display  rows of data with a checkbox on
each
> > row and an invisible column?  I see a Columns collection but cannot find
> an
> > example showing how to populate the control with data.

> > [  ]     Dog           Canine           Carnivore
> > [  ]     Cat             Feline           Carnivore
> > [x]     Cow          Bovine           Herbivore
> > [  ]     Horse         Equine           Herbivore

> > TIA
> > Tim



Wed, 09 Feb 2005 10:45:30 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Drag an item of Listview to another position of the same ListView

2. Ownerdraw works with ListView 5.0 but not with ListView 6.0

3. Dragging from ListView to ListView or TreeView

4. Listview vs. Extended Listview

5. Listview: synchronize two listviews

6. Ownerdraw works with ListView 5.0 but not with ListView 6.0 (in this sample)

7. Listview: check if an item in current listview

8. ListView to ListView copying ???

9. ListView column width = ListView width ?

10. changing the background of a listview item in the listview control

11. Listview Control - moving items from one listview to another

12. Listview: Determining ListView from ListItem????

 

 
Powered by phpBB® Forum Software