| I just maded a own userControl. In my UserControl you can find a textbox and a ListView.
When I add my selfmaded userControl to my form, I don't see the event 'SelectedIndexChance' ... . How can I reach this eventhandler of my ListView (of my UserControl) from my form ? |
How can I make the eventhandler SelectedIndexChance (from a ListView) public in a selfmade UserControl ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Bechir BejaouiRank #144 · 15.9K reputationPosted Mar 22, 2008, 5:31 AM EDT
public void SelectedElementChanged()
{
listView1.SelectedIndexChanged +=new EventHandler(listView1_SelectedIndexChanged);
}
/* I set it protected to be only visible by the derived classes you can set it public or internal if you want */
protected void listView1_SelectedIndexChanged(Object sender, EventArgs e)
{
//Put your code here to perform your tasks
}
When the intellisense appears SelectedElementChanged will appear as one of the control 's method