Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

How to compare a string list with the text of a listview column.

Hi,

I have a listview where the user can insert a listview row through an input-form. The user can double click on the row then the input-form appears. The user can also select the row be dragging the cursor. To prevent from appearing the input-form twice. I have used a string list to keep track of the input-form that is allready opened by using an unique identifier (the creation date of the input-form) which is stored in column1 I have this for the double click event and it works great:

private List<string> opened = new List<string>();

        private void lvNotes_DoubleClick(object sender, EventArgs e)
        {
            string selectedId = this.lvNotes.SelectedItems[0].SubItems[1].Text(); 
            if (opened.Contains(selectedId)) return;
            OpenSticky(lvNotes.SelectedItems[0]);
        } 

Open in new window


But I don't know how to do this in the event below when the user selects the row(s) by dragging with the cursor and click on the button bbEdtNote it first have to look in the string list if the input form(s) has allready opened. If so then ignore otherwise open them.

        private void bbEdtNote_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (lvNotes.SelectedItems.Count == 0) return;
            foreach (ListViewItem lvi in this.lvNotes.SelectedItems)
            {
                OpenSticky(lvi);
            }
        }

Open in new window


Who knows the answer and is willing to help me?

Greetings,

Peter Kiers
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Oke thanks. Greetings, Peter Kiers