• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

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

0
peterkiers
Asked:
peterkiers
  • 2
1 Solution
 
Jacques Bourgeois (James Burger)Commented:
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)Commented:
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

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now