Custom link

Top  Previous  Next

Using this type of link you can define own reaction to the clicking of the mouse. For this, use the "Click" event handler of the object. To do this:

 

select the object and open the "Properties" window;
Click the btn79 button to show the object's events;
double click on the "Click" event. FastReport switches to the "Code" window and creates an empty event handler.

 

In the handler's code, do everything what you need. You, most likely, will need a link to the object, which the handler calls, and a hyperlink's value. Use the handler's parameter sender:

 

private void Text2_Click(object sender, EventArgs e)

{

  // sender - this is the object which was clicked.

  // In order to receive the value of the hyperlink, you need 

  // to cast the sender to ReportComponentBase type.

  object hyperlinkValue = (sender as ReportComponentBase).Hyperlink.Value;

 

  MessageBox.Show("Hyperlink value = " + hyperlinkValue.ToString());

}