[c# winform] ListView MultiColumn, Icon and ToolTip

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • piercy
    New Member
    • Aug 2007
    • 77

    [c# winform] ListView MultiColumn, Icon and ToolTip

    Hi, ive been trying to produce something using a listview control which shows error messages for the emails sent from my application. Its a wierd concept so im going to try explain it best i can. I want to be able to have 3 items across the listbox each with a icon and a tooltip. Something similar to the below.. Item 1 has a icon next to it and when i hover over it i get a tooltip displaying the error message. Then the same again for items 2,3,4 etc.etc.
    Code:
    |  Item 1 | Item 2 | Item 3 |
    |  Item 4 | Item 5 | Item 6 |

    Heres the code i have at the moment which only does single column.
    Code:
    foreach (DataRow row in ds1.Tables["Receipitants"].Rows)
                {
                    if (row.ItemArray[1].ToString() != null)
                    {
                        if (row.ItemArray[1].ToString().Length > 0)
                        {
                            ListViewItem lvi = new ListViewItem(row.ItemArray[3].ToString() + " (" + row.ItemArray[1].ToString() + ")");
                            lvi.ToolTipText = row.ItemArray[4].ToString();
                            lvi.ImageIndex = 0;
                            listView1.Items.Add(lvi);
                        }
                        else
                        {
                            ListViewItem lvi = new ListViewItem(row.ItemArray[3].ToString());
                            lvi.ToolTipText = row.ItemArray[4].ToString();
                            lvi.ImageIndex = 1;
                            listView1.Items.Add(lvi);
                        }
                    }
                    else
                    {
                        ListViewItem lvi = new ListViewItem(row.ItemArray[3].ToString());
                        lvi.ToolTipText = row.ItemArray[4].ToString();
                        lvi.ImageIndex = 1;
                        listView1.Items.Add(lvi);
                    }
                }
    row.ItemArray[0] = ID;
    "" "" [1] = email address
    "" "" [4] = Error Message

    Anyone know how i may go about producing what i need. I'm hoping theres an option im missing. I tried using 3 columns with sub items but subitems dont allow icons or tooltips.


    Many Thanks,
    Piercy
  • piercy
    New Member
    • Aug 2007
    • 77

    #2
    After playing some more i manged to use the tile view to display how i need. However, Ive got a wierd problem where the icons sometims display and some times dont. There does not seem to be any pattern to them not loading. Ive tried starting the program waiting fopr 5 mins then opening the form (onclick of button). Ive tried rushing through and seeing if it makes a difference but i still can work it out. It seems completly random, i saw a post where some one else experienced the same problem but there were no replys. Any one seen this? Anyone got any ideas on how to fix this?

    Many Thanks,
    Piercy

    ps. i didnt think it was necersery to create a new thread for this.. altho i will if need be.

    Comment

    Working...