I have a Form that emulates a virtual (on screen) keyboard with a DataGridView. This form is in a library that I want to keep it decoupled from the data layer. How can I pass this form a method to search the database and return a DataTable which I can display in the Form?
public partial class AlphaKeypad : Form
{
public AlphaKeypad(delegate here)
{
...
}
}
How will I use the delegate in that form?
EDIT: I wasn't very clear in my original question, so I edited a little:
In MainForm() I have a method called Search like this:
public DataTable Search(string filter)
{
...
}
I want to pass that method to AlphaKeypad() to be handled this way: When the user presses some keys, I want to call the Search() function with the text entered, and display in AlphaKeypad's dridview the returned DataTable from the database.
Hope this is clear now.
Thanks!