using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Payroll.Controls.CustomControls { public partial class ctlDAManagement : UserControl { public event EventHandler Changed; private ToolTip _tooltip; public ctlDAManagement() { InitializeComponent(); _tooltip = new ToolTip(); } #region Property Code : String private string _Code; public string Code { get { return _Code; } set { _Code = value; } } #endregion #region Events private void txtCode_Leave(object sender, EventArgs e) { try { if (txtCode.Text.Trim().Length > 0) { Code = txtCode.Text.Trim(); } if (Changed != null) { Changed(sender, e); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btnPick_Click(object sender, EventArgs e) { fSearchDisciplineAction oPicker = new fSearchDisciplineAction(); if (!oPicker.ShowDlg()) { _tooltip.SetToolTip(txtCode, txtCode.Text); txtCode.Text = oPicker.DACode; } else if(Code=="") { txtCode.Text = ""; _tooltip.SetToolTip(txtCode, ""); } Code = txtCode.Text.Trim(); if (Changed != null) { Changed(sender, e); } } #endregion } }