//private void dataGridViewSources_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        //{
        //    if (e.ColumnIndex == 1 && dataGridViewSources.RowCount > 1)
        //    {
        //        if (Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value) != 0 && e.RowIndex != 0 && e.RowIndex != 8 && e.RowIndex != 12 && e.RowIndex != 16 && e.RowIndex != 22)
        //            dataGridViewSources[1, e.RowIndex].Value = "1";
        //        if (e.RowIndex < 12)
        //        {
        //            rs.eventIdentifyRisk[0][e.RowIndex] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }
        //        else if (e.RowIndex < 22)
        //        {
        //            rs.eventIdentifyRisk[1][e.RowIndex - 12] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }
        //        else if (e.RowIndex < 34)
        //        {
        //            rs.eventIdentifyRisk[2][e.RowIndex - 22] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }
        //        else if (e.RowIndex < 51)
        //        {
        //            rs.eventIdentifyRisk[3][e.RowIndex - 34] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }

        //        rs.CountPotentialRiskEvents();
        //        ShowResult();
        //    }
        //}

        private void dataGridViewSources1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1 && dataGridViewSources.RowCount > 1)
            {
                if (Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value) != 0 && e.RowIndex != 0 && e.RowIndex != 12 && e.RowIndex != 22 && e.RowIndex != 34 && e.RowIndex != 51)
                {
                    dataGridViewSources[1, e.RowIndex].Value = "1";
                }
                if (e.RowIndex < 12)
                {
                    rs.eventIdentifyRisk[0][e.RowIndex] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }
                else if (e.RowIndex < 22)
                {
                    CheckCorrect(e.RowIndex);
                    rs.eventIdentifyRisk[1][e.RowIndex - 12] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }
                else if (e.RowIndex < 34)
                {
                    CheckCorrect(e.RowIndex);
                    rs.eventIdentifyRisk[2][e.RowIndex - 22] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }
                else if (e.RowIndex < 51)
                {
                    CheckCorrect(e.RowIndex);
                    rs.eventIdentifyRisk[3][e.RowIndex - 34] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }

                rs.CountPotentialRiskEvents();
                ShowResult();
            }
        }
        public FormPotentialRiskEvents(RiskManagementLib _rs)
        {
            rs = _rs;
            InitializeComponent();

            rs.CountPotentialRiskEvents();
            CreateTable();
        }