private void btnOk_Click(object sender, EventArgs e)
 {
     // If there's a validation function, check and only set if valid, otherwise assume all text is valid.
     if (EntryValidation != null)
     {
         if (!EntryValidation.Invoke(tbInput.Text))                      // Validation fails.
         {
             MessageBox.Show("Invalid Entry!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     Hide();
 }