Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
we call button click event handler as
C#
this.SignButton_Click( sender, e );

similarly how do we call click event handler of LinkLabel control.
If it is called like this
C#
this.signPathLinkLbl_LinkClicked(sender, e);
it throws error as
Argument 2: cannot convert from 'System.EventArgs' to 'System.Windows.Forms.LinkLabelLinkClickedEventArgs'
Posted

seems you need a little workaround here

C#
private void button1_Click(object sender, EventArgs e)
       {

           LinkLabelLinkClickedEventArgs ex = new LinkLabelLinkClickedEventArgs(linkLabel1.Links[0]);
           linkLabel1_LinkClicked(sender, ex);
       }

       private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
       {
           MessageBox.Show("link clicked");
       }

this is just a sample do a little workaround on it
 
Share this answer
 
The declaration of your signPathLinkLbl_LinkClicked method should be:
C#
private void signPathLinkLbl_LinkClicked(object sender, LinkClickedEventArgs e) {
   // Good one
}

instead of
C#
private void signPathLinkLbl_LinkClicked(object sender, EventArgs e) {
   // Bad one
}


Of course, you have to wire the event of your control to the event handler; in the designer file, there should be a line:
C#
this.signPathLinkLbl.LinkClicked += this.signPathLinkLbl_LinkClicked;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900