how to get listview.ItemCheck event to fire?

M

mp

from msdn there are two events that are supposed to fire when an item is
checked
ItemCheck and ItemChecked
I don't see an explanation of the difference but i cant' get either one to
fire.

ah, now one is, don't know what i did to get it...but in general...how do i
get
all the various events on a control....double clicking the control in the
designer will
stub out one event...but what about the others?

example

if i double click in the listview lvCriteriaList, this code appears in the
codebehind.cs
private void lvCriteriaList_SelectedIndexChanged(object sender, EventArgs e)
{

}
and also this line appears in the designer.cs file
this.lvCriteriaList.SelectedIndexChanged += new
System.EventHandler(this.lvCriteriaList_SelectedIndexChanged);


I don't know how to get at other events
but i copied/pasted/modified an event from msdn for item check
private void lvCriteriaList_ItemCheck(object sender,
System.Windows.Forms.ItemCheckEventArgs e)
{
MessageBox.Show("item check");
}

but it wasn't firing because there was nothing for it in the designer.cs
file
---now there is...don't know how it got there...been trying few things to
try to get event to fire
somehow the ide finally wrote in the line
this.lvCriteriaList.ItemCheck += new
System.Windows.Forms.ItemCheckEventHandler(this.lvCriteriaList_ItemCheck);

how do you get all the available events
so when you write an event handler
the ide writes the "event subscription line"??(whatever the correct term is)
into the designer.cs

thanks
mark
 
J

Jeff Johnson

ah, now one is, don't know what i did to get it...but in general...how do
i get
all the various events on a control....double clicking the control in the
designer will
stub out one event...but what about the others?

Select a control on your form and then look at the Properties window. You
should see a button in the toolbar with a lightning bolt. Click this button
and you'll be given a list of all the events this control exposes. You can
double-click an event to get a stub created or you can use the drop-down to
pick from existing methods in your code that have a signature which matches
that event's delegate (handy when you have one handler for several events).
Click the properties button beside it to go back to properties view.
 
M

mp

Jeff Johnson said:
Select a control on your form and then look at the Properties window. You
should see a button in the toolbar with a lightning bolt. Click this
button and you'll be given a list of all the events this control exposes.
You can double-click an event to get a stub created or you can use the
drop-down to pick from existing methods in your code that have a signature
which matches that event's delegate (handy when you have one handler for
several events). Click the properties button beside it to go back to
properties view.

Thanks Jeff,
I knew it was in there somewhere(the lightnign bolt),couldn't remember how
to get back to it!
selecting the control is the trick
thanks
mark
 
J

Jeff Johnson

Not that it matters, but what I really meant to say was "handy when you have
one handler for the same event for multiple CONTROLS." You usually don't use
the same method to handle multiple EVENTS, although I suppose it's possible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top