ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Win Assembly / GrapeCity.ActiveReports.Viewer.Win Namespace / Viewer Class / Find Event
Example

In This Topic
    Find Event
    In This Topic
    Occurs when the Find dialog successfully locates the specified text within the document.
    Syntax
    'Declaration
     
    Public Event Find As FindEventHandler
    public event FindEventHandler Find
    Event Data

    The event handler receives an argument of type FindEventArgs containing data related to this event. The following FindEventArgs properties provide information specific to this event.

    PropertyDescription
    Gets a value that determines whether the text was found.  
    Gets the page number where the text was found.  
    Remarks
    The FindEventArgs associated with this event provides details about the found text, including its location and the context in which it was found.
    Example
    public partial class MyForm : Form
    {
    	private Viewer viewer;
    	public MyForm()
    	{
    		InitializeComponent();
    		viewer = new Viewer();
    		
    		// Subscribe to the Find event
    		viewer.Find += Viewer_Find;
    		
    		this.Controls.Add(viewer);
    		viewer.Dock = DockStyle.Fill;
    	}
    }
    private void Viewer_Find(object sender, FindEventArgs e)
    {
    	if (e.Found)
    		MessageBox.Show($"Text found on page {e.PageIndex + 1}.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
    	else
    		MessageBox.Show("Text not found.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    See Also