lordleslie

hi all. sorry to trouble you all again.

i wanna select a specific item in a listview. i searched the forum and found a similar thread. someone suggested to use the ItemActivatedEvent.

but the thing is that this doesn't work at all for the threader and me as well.

can someone help please

thanks (:

lordleslie




Re: .NET Compact Framework Select Items In ListView

lordleslie

hey guys, from the MSDN online documentation, i've found the codes for the listview activation and the itemActivate event. but it still not working for my project. can anyone help me out

http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.activation.aspx

they say use this: "public ItemActivation Activation { get; set; }" but i don't know how it works. then i was working along the visual basic version and do this instead "listView.Activation = ItemActivation.OneClick;"

http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.itemactivate.aspx

it's said that this should work:

private void listView_Schedule_ItemActivate(Object sender, EventArgs e)

{

MessageBox.Show("You are in the ListView.ItemActivate event.");

}

but then nothing seems to be happening when i clicked once or twice or many times.

can someone help me Thanks!

lordleslie






Re: .NET Compact Framework Select Items In ListView

dotnetideas

We use this event all the time. I hope you didn't forget the following code.

listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate);






Re: .NET Compact Framework Select Items In ListView

lordleslie

thanks for your help dotnetideas (: managed to get it working now (:

anyway, i've got another problem now. (sorry, i know i'm a bit pain in the a**)

ListView.SelectedIndexCollection SelectedSpecimenIndex = this.listView_Schedule.SelectedIndices;

foreach (int index in SelectedIndex)

{

SelectedItem = this.listView_Schedule.Items[index].SubItems[1].Text;

Messagebox.Show(SelectedItem);

}

i use the above code to retrieve the selected item's data. the thing is that i can't retrieve the data inside SelectedItem or index outside of the foreach function. is there another way of retrieving the data






Re: .NET Compact Framework Select Items In ListView

dotnetideas

I doubt it. You can use SelectedItems. But you will still need to loop through it.






Re: .NET Compact Framework Select Items In ListView

lordleslie

thanks for your help (: