W
WAkthar
Hi,
I need to be able to display a listview with the following functionality.
The listview must be able to display different types of information.
There are normally 3 types.
Type 1 has only 1 column.
The first row must display an icon showing the status of this type.
The following rows must display text messages.
Type 2 has only 2 columns
The first row, first column must display an icon showing the status of this
type.
The following rows, second column must display text messages.
Type 3 is similar.
Now for Type 1, I can get to display the icon but when I try to display
messages in the next rows they appear in the second column!
Here is the following code.
else if (type1Object != null)
{
if (!populated)
AddType1ColumnsHeaders();
int mods = type1Object.Display;
switch(type1Object.Status)
{
case SignStatusTypes.OK:
// OK
imgStatus = (int)ImageStatusTypes.OK;
break;
case SignStatusTypes.FAULTY:
// FAULTY
imgStatus = (int)ImageStatusTypes.FAULTY;
break;
case SignStatusTypes.UNKNOWN:
// UNKNOWN
imgStatus = (int)ImageStatusTypes.UNKNOWN;
break;
}
ListViewItem lstvwItem1 = listView1.Items.Add("");
lstvwItem1.ImageIndex = imgStatus;
for(int i=0; i<mods; i++)
{
if (i == 0)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text0);
}
else if (i == 1)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text1);
}
else if (i == 2)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text2);
}
else if (i == 3)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text3);
}
}
}
private void AddType1ColumnsHeaders()
{
listView1.Columns.Clear();
listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
listView1.Columns.Add("Display", -2, HorizontalAlignment.Left);
}
Please can someone help!! Thanks in advance!
I need to be able to display a listview with the following functionality.
The listview must be able to display different types of information.
There are normally 3 types.
Type 1 has only 1 column.
The first row must display an icon showing the status of this type.
The following rows must display text messages.
Type 2 has only 2 columns
The first row, first column must display an icon showing the status of this
type.
The following rows, second column must display text messages.
Type 3 is similar.
Now for Type 1, I can get to display the icon but when I try to display
messages in the next rows they appear in the second column!
Here is the following code.
else if (type1Object != null)
{
if (!populated)
AddType1ColumnsHeaders();
int mods = type1Object.Display;
switch(type1Object.Status)
{
case SignStatusTypes.OK:
// OK
imgStatus = (int)ImageStatusTypes.OK;
break;
case SignStatusTypes.FAULTY:
// FAULTY
imgStatus = (int)ImageStatusTypes.FAULTY;
break;
case SignStatusTypes.UNKNOWN:
// UNKNOWN
imgStatus = (int)ImageStatusTypes.UNKNOWN;
break;
}
ListViewItem lstvwItem1 = listView1.Items.Add("");
lstvwItem1.ImageIndex = imgStatus;
for(int i=0; i<mods; i++)
{
if (i == 0)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text0);
}
else if (i == 1)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text1);
}
else if (i == 2)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text2);
}
else if (i == 3)
{
lstvwItem1 = listView1.Items.Add(type1Object.Text3);
}
}
}
private void AddType1ColumnsHeaders()
{
listView1.Columns.Clear();
listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
listView1.Columns.Add("Display", -2, HorizontalAlignment.Left);
}
Please can someone help!! Thanks in advance!