Example #1
0
        private void btn_print_Click(object sender, EventArgs e)
        {
            isnew = false;

            int    r = -1;
            String code = "", name = "";

            try
            {
                r = dgv_list.CurrentRow.Index;
                if (dgv_list.Rows.Count > 1)
                {
                    code = dgv_list["ID", r].Value.ToString();
                    if (!String.IsNullOrEmpty(code))
                    {
                        RPT_RES_entry frm = new RPT_RES_entry("M101", "Employee Information");
                        frm.print_employees(code);
                        frm.Show();
                    }
                    else
                    {
                        MessageBox.Show("No selected item.");
                    }
                }
                else
                {
                    MessageBox.Show("Employee list is empty.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }