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
Peter KiersOperatorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Peter KiersOperatorAuthor Commented:
Oke I'll test it tonight.

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

Peter
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.