Ejemplo n.º 1
0
 private void VoucherGrid_EditorKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (VoucherGridView.FocusedColumn.FieldName == "Credit" || VoucherGridView.FocusedColumn.FieldName == "Debit")
         {
             VoucherGridView.FocusedColumn = VoucherGridView.Columns["Narration"];
             VoucherGridView.ShowEditor();
         }
     }
 }
Ejemplo n.º 2
0
        private void HelpGrid_DoubleClick(object sender, EventArgs e)
        {
            HelpGridView.CloseEditor();
            HelpGridView.UpdateCurrentRow();
            DataRow row = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle);

            if (HelpGrid.Text == "txtVoucherTypeCode")
            {
                txtVoucherTypeCode.Text = row["VouCode"].ToString();
                txtVoucherTypeDesc.Text = row["VouDesc"].ToString();
                HelpGrid.Visible        = false;
                panelControl2.Visible   = false;
                txtAccountCode.Focus();
            }
            if (HelpGrid.Text == "txtAccountCode")
            {
                txtAccountCode.Text   = row["AccCode"].ToString();
                txtAccountName.Text   = row["AccName"].ToString();
                HelpGrid.Visible      = false;
                panelControl2.Visible = false;
                txtShortNarration.Focus();
            }

            if (HelpGrid.Text == "AccCode")
            {
                if (HelpGridView.RowCount > 0)
                {
                    DataRow dtNewRow = dt.NewRow();
                    dtNewRow["AccCode"]   = row["AccCode"].ToString();
                    dtNewRow["AccName"]   = row["AccName"].ToString();
                    dtNewRow["Amount"]    = Convert.ToDecimal("0.00");
                    dtNewRow["Narration"] = string.Empty;
                    dtNewRow["CRDR"]      = SetCrDrValue();

                    dt.Rows.Add(dtNewRow);
                    if (dt.Rows.Count > 0)
                    {
                        VoucherGrid.DataSource = dt;
                        VoucherGridView.BestFitColumns();
                    }
                    else
                    {
                        VoucherGrid.DataSource = null;
                        VoucherGridView.BestFitColumns();
                    }
                    panelControl2.Visible = false;
                    VoucherGridView.Focus();
                    VoucherGridView.MoveLast();
                    VoucherGridView.FocusedColumn = VoucherGridView.Columns["Amount"];
                    VoucherGridView.ShowEditor();
                    txtSearchBox.Text = string.Empty;
                }
            }
        }