Example #1
0
        private bool checkInputData(DataGridView dgv)
        {
            string checkStr;

            for (int i = 0; i < dgv.RowCount; i++)
            {
                if (dgv.Rows[i].Cells["Cost"].Value != null)
                {
                    for (int j = 3; j < dgv.ColumnCount; j++)
                    {
                        if (j != 4)
                        {
                            checkStr = Convert.ToString(dgv.Rows[i].Cells[j].Value);
                            if (checkStr == null || checkStr == "")
                            {
                            }
                            else
                            {
                                if (!DHandling.IsDecimal(checkStr))
                                {
                                    DMessage.ValueErrMsg();
                                    //dgv[j, i].Style.BackColor = Color.Red;
                                    dgv.CurrentCell = dgv[j, i];
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
Example #2
0
 private bool checkDecimalValue(string checkStr)
 {
     if (!String.IsNullOrEmpty(checkStr))
     {
         if (!DHandling.IsDecimal(checkStr))
         {
             DMessage.ValueErrMsg();
             return(false);
         }
     }
     return(true);
 }
Example #3
0
        private void textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (iniPro)
            {
                return;
            }

            TextBox tb = (TextBox)sender;

            if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
            {
                switch (tb.Name)
                {
                case "textBoxSlipNo":
                    if (textBoxSlipNo.Text == "")
                    {
                        DMessage.ValueErrMsg();
                        return;
                    }

                    if (!DHandling.IsNumeric(textBoxSlipNo.Text))
                    {
                        DMessage.ValueErrMsg();
                        return;
                    }

                    if (curSlipNo == Convert.ToInt32(textBoxSlipNo.Text))
                    {
                        return;
                    }

                    if (!dispCostReportData(Convert.ToInt32(textBoxSlipNo.Text)))
                    {
                        MessageBox.Show("指定された伝票番号のデータはありません");
                        return;
                    }

                    curSlipNo = Convert.ToInt32(textBoxSlipNo.Text);

                    break;

                case "textBoxTaskCode":
                    if (!dispTaskInformation(textBoxTaskCode.Text))
                    {
                        MessageBox.Show("指定された業務番号のデータはありません");
                    }
                    break;

                default:
                    break;
                }
            }

            if ((e.Modifiers & Keys.Control) != Keys.Control)
            {
                return;                                                 // Ctrlキーが押下された時のみ以下処理
            }
            switch (e.KeyCode)
            {
            case Keys.A:
                chooseTaskCodeNameData();
                break;

            default:
                break;
            }
        }