Hello
I've been searching forums for solution of my problem. I think it's very simple but I have no idea how to make it works. In my project I have got a simple listview with *.txt file names from program directory. I would apprecciate it if someone told me how to get value (file name) of currently selected key.
Any help would be welcomed!

Question from newbie about reading file name from listview
Scheinka
you can refer to the item with the selecteditems property of the listview. you can get the text value by using listview1.selecteditems(0).text if you are on the first column. hope this helps...
Dave
Ta1os
chipjollyroger
TobsTec
It goes like this:
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
string Itm;
for (int i = 0; i < listView1.Items.Count; i++)
{
if (listView1.Items
{
Itm = listView1.Items
MessageBox.Show(Itm);
}
}
Thanks, for trying to help!
Tryst
Oops, that was on VB, my bad... try this on c#:
private void listView1_DoubleClick(object sender, EventArgs e)
{
string itm = this.listView1.SelectedItems[0].Text;
MessageBox.Show(itm);
}
just to show that you're getting the the value when you double click. you can change the event for your own purpose :)
Dave.
Patrick0
SelectedItems is not in Compact Framework
I used somethink like:
ListView.SelectedIndexCollection indexes = this.MyList.SelectedIndices;foreach (int index in indexes)
{
fieldtext1.Text = MyList.Items[index].Text;
fieldtext2.Text = MyList.Items[index].SubItems[2].Text;
}
index on PDA is only 1 number .... there is not multiline choose
Pockey
When I try to bulid application I'm still getting "Error 1 'System.Windows.Forms.ListView' does not contain a definition for 'SelectedItems'". Do you konow how to describe "SelectedItems" in private void InitializeComponent() in ListView section
Sorry for being importunate but I really have no idea how to do it...