I am trying to get data from a CollectionBase derived class into a ListView.
Currently the output is one continuous line of data that is of Boolean type
e.g. True True False True False False False True .

No other data or header information is displayed.



public class RecFormCtxSaved
{
private Boolean enabled;
private Boolean selected;
private string column;
private string text;
}

private void createListView()
{
ListViewItem lvi;

this.listView1.Columns.Add("Enable", 50, HorizontalAlignment.Left);
this.listView1.Columns.Add("Select", 50, HorizontalAlignment.Left);
this.listView1.Columns.Add("Column", 50, HorizontalAlignment.Left);
this.listView1.Columns.Add("Text", 50, HorizontalAlignment.Left);

foreach (RecFormCtxSaved rec in coll)
{
lvi = new ListViewItem();
lvi.Text = rec.Enabled.ToString();
lvi.SubItems.Add(rec.Selected.ToString());
lvi.SubItems.Add(rec.Column);
lvi.SubItems.Add(rec.Text);
this.listView1.Items.Add(lvi);
}
}

Re: Help with ListView by letsdotnet

letsdotnet
Wed Sep 24 18:11:16 CDT 2003

Hi David,
You should set the View property of your ListBox to Details.


Deepak

#*#*#*#*#*#*#*#*#*#*#*#
I Code therefore I am

David Elliott <DavidElliott@BellSouth.net> wrote in message news:<gpn3nvc5vfk16lt2l6oq7b410ri1bg14hj@4ax.com>...
> I am trying to get data from a CollectionBase derived class into a ListView.
> Currently the output is one continuous line of data that is of Boolean type
> e.g. True True False True False False False True .
>
> No other data or header information is displayed.
>
>
>
> public class RecFormCtxSaved
> {
> private Boolean enabled;
> private Boolean selected;
> private string column;
> private string text;
> }
>
> private void createListView()
> {
> ListViewItem lvi;
>
> this.listView1.Columns.Add("Enable", 50, HorizontalAlignment.Left);
> this.listView1.Columns.Add("Select", 50, HorizontalAlignment.Left);
> this.listView1.Columns.Add("Column", 50, HorizontalAlignment.Left);
> this.listView1.Columns.Add("Text", 50, HorizontalAlignment.Left);
>
> foreach (RecFormCtxSaved rec in coll)
> {
> lvi = new ListViewItem();
> lvi.Text = rec.Enabled.ToString();
> lvi.SubItems.Add(rec.Selected.ToString());
> lvi.SubItems.Add(rec.Column);
> lvi.SubItems.Add(rec.Text);
> this.listView1.Items.Add(lvi);
> }
> }

Re: Help with ListView by David

David
Wed Sep 24 20:46:35 CDT 2003

Thanks...

Any idea on how to change the text of True to a check mark and False to blank?




On 24 Sep 2003 16:11:16 -0700, letsdotnet@hotmail.com (Deepak Kapoor) wrote:

>Hi David,
>You should set the View property of your ListBox to Details.
>
>
>Deepak
>
>#*#*#*#*#*#*#*#*#*#*#*#
>I Code therefore I am
>
>David Elliott <DavidElliott@BellSouth.net> wrote in message news:<gpn3nvc5vfk16lt2l6oq7b410ri1bg14hj@4ax.com>...
>> I am trying to get data from a CollectionBase derived class into a ListView.
>> Currently the output is one continuous line of data that is of Boolean type
>> e.g. True True False True False False False True .
>>
>> No other data or header information is displayed.
>>
>>
>>
>> public class RecFormCtxSaved
>> {
>> private Boolean enabled;
>> private Boolean selected;
>> private string column;
>> private string text;
>> }
>>
>> private void createListView()
>> {
>> ListViewItem lvi;
>>
>> this.listView1.Columns.Add("Enable", 50, HorizontalAlignment.Left);
>> this.listView1.Columns.Add("Select", 50, HorizontalAlignment.Left);
>> this.listView1.Columns.Add("Column", 50, HorizontalAlignment.Left);
>> this.listView1.Columns.Add("Text", 50, HorizontalAlignment.Left);
>>
>> foreach (RecFormCtxSaved rec in coll)
>> {
>> lvi = new ListViewItem();
>> lvi.Text = rec.Enabled.ToString();
>> lvi.SubItems.Add(rec.Selected.ToString());
>> lvi.SubItems.Add(rec.Column);
>> lvi.SubItems.Add(rec.Text);
>> this.listView1.Items.Add(lvi);
>> }
>> }


Re: Help with ListView by letsdotnet

letsdotnet
Thu Sep 25 01:17:48 CDT 2003

This is what you can do
set listView1.CheckBoxes = true;
this will display a check box

now do a if condition

if(listView1.Items[0].Text == "true")
listView1.Items[0].Checked = true;
else
listView1.Items[0].Checked = false;


David Elliott <DavidElliott@BellSouth.net> wrote in message news:<s8i4nvcjh5t4p5ecijtnqpn1v72dotmffu@4ax.com>...
> Thanks...
>
> Any idea on how to change the text of True to a check mark and False to blank?
>
>
>
>
> On 24 Sep 2003 16:11:16 -0700, letsdotnet@hotmail.com (Deepak Kapoor) wrote:
>
> >Hi David,
> >You should set the View property of your ListBox to Details.
> >
> >
> >Deepak
> >
> >#*#*#*#*#*#*#*#*#*#*#*#
> >I Code therefore I am
> >
> >David Elliott <DavidElliott@BellSouth.net> wrote in message news:<gpn3nvc5vfk16lt2l6oq7b410ri1bg14hj@4ax.com>...
> >> I am trying to get data from a CollectionBase derived class into a ListView.
> >> Currently the output is one continuous line of data that is of Boolean type
> >> e.g. True True False True False False False True .
> >>
> >> No other data or header information is displayed.
> >>
> >>
> >>
> >> public class RecFormCtxSaved
> >> {
> >> private Boolean enabled;
> >> private Boolean selected;
> >> private string column;
> >> private string text;
> >> }
> >>
> >> private void createListView()
> >> {
> >> ListViewItem lvi;
> >>
> >> this.listView1.Columns.Add("Enable", 50, HorizontalAlignment.Left);
> >> this.listView1.Columns.Add("Select", 50, HorizontalAlignment.Left);
> >> this.listView1.Columns.Add("Column", 50, HorizontalAlignment.Left);
> >> this.listView1.Columns.Add("Text", 50, HorizontalAlignment.Left);
> >>
> >> foreach (RecFormCtxSaved rec in coll)
> >> {
> >> lvi = new ListViewItem();
> >> lvi.Text = rec.Enabled.ToString();
> >> lvi.SubItems.Add(rec.Selected.ToString());
> >> lvi.SubItems.Add(rec.Column);
> >> lvi.SubItems.Add(rec.Text);
> >> this.listView1.Items.Add(lvi);
> >> }
> >> }