开发者

C# listview clickable column and row

开发者 https://www.devze.com 2022-12-25 05:18 出处:网络
What I have going on is a listview inside of my windows form. How can I make so that only when you double click a row it pulls data for row X and column 3.

What I have going on is a listview inside of my windows form.

How can I make so that only when you double click a row it pulls data for row X and column 3.

meaning I have a listview of...

A|B|C|D

1|2|3|4

@|#|$|%

Bc|Dv|D#|dg

so if i double clicked row thats begins with @ it will read in column 3 ($).

I ale开发者_Python百科ady have FullRowSelect = True

I figured this out thanks everyone!

string hyperurl = listView1.FocusedItem.SubItems[2].Text;


Use this code for your ListView's DoubleClick event:

private void listView1_DoubleClick(object sender, EventArgs e)
{
    if (listView1.SelectedItems.Count > 0)
    {
        ListViewItem item = listView1.SelectedItems[0];
        MessageBox.Show(item.SubItems[2].ToString());
    }
}


Maybe this can help:

http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.selectedindexchanged.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消