Calling for a toolbar-button methode from another methode

HI,

I have a toolbar-button that has a tbDelNote_ItemClick-event.
Now I want to call for the tbDelNote_ItemClick-event from another
methode.

I have tried:
1. tbDelNote_ItemClick()
2. tbDelNote_ItemClick(sender)
3.t bDelNote_ItemClick(self)

But these 3 attemps did not work.
How can i call for the tbDelNote_ItemCLick event?

P.S: I am only all day but I only can test the solution tonight.

Greetings,

Peter Kiers



private void tbDelNote_ItemClick(object sender, ItemClickEventArgs e)
        {
            foreach (ListViewItem item in lvNotes.SelectedItems)
            {
                lvNotes.Items.Remove(item);
            }
        }

Open in new window

LVL 1
peterkiersAsked:
Who is Participating?
 
Jacques Bourgeois (James Burger)PresidentCommented:
The method needs 2 parameters, so you need to pass 2 parameters. Since you are not using either the sender or the IetmClickEventArgs inside of the event, simply pass null.
tbDelNote_ItemClick(null,null)

Open in new window

0
 
peterkiersAuthor Commented:
Oke I'll test it tonight.

Can this be done too: tbDelNote_ItemCLick(Sender, e);

Peter
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
sender and e would then need to be declared. What would you put in sender? What you put in e?

The sender is usually the caller of the event. e are parameters sent to the event. Since you use neither in the procedure, it would be useless to send those parameters.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.