- Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function
- if (dgv_Panchang.CurrentCell.ColumnIndex == 1)
- {
- if (cmbBox == null) { return; }
- else
- {
- cmbBox.SelectedIndexChanged += new EventHandler(cmbBox_SelectedIndexChanged);
- }
- }
- else if (dgv_Panchang.CurrentCell.ColumnIndex == 4)
- {
- cmbBox.SelectedIndexChanged -= new EventHandler(cmbBox_SelectedIndexChanged);
- cmbBox.SelectedIndexChanged += new EventHandler(cmbBox_SelectedIndexChanged);
- }
- }
- private void cmbBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- // dgv_Panchang.EndEdit();
- string SpID = string.Empty;
- //ComboBox cmbBox = (ComboBox)sender;
- ComboBox cmbBox = new ComboBox();
- cmbBox = (ComboBox)sender;
- if (cmbBox != null)
- {
- if (dgv_Panchang.CurrentCell.ColumnIndex == 1)
- {
- Cls_Global_Var.Name = string.Empty;
- Cls_Global_Var.Name = cmbBox.SelectedItem.ToString();
- if (Cls_Global_Var.Name != string.Empty)
- {
- Cls_Global_Var.StrSql = string.Empty;
- Cls_Global_Var.StrSql = "select Pk_SpecialDay from tbl_specialday where V_Title ='" + Cls_Global_Var.Name + "'";
- SpID = Cls_DataBase.GetIdentCurrentID(Cls_Global_Var.StrSql);
- if (SpID != null)
- {
- int RowIndex = dgv_Panchang.CurrentCell.RowIndex;
- int ColIndex = dgv_Panchang.CurrentCell.ColumnIndex;
- DataGridViewCell dgvCurrent = dgv_Panchang[ColIndex + 2, RowIndex];
- if (dgvCurrent != null)
- {
- dgv_Panchang.CurrentCell = dgvCurrent;
- dgv_Panchang.CurrentRow.Cells["SPDValue"].Value = SpID;
- Cls_PanchangMaster_Obj.GetSpecialDayName(Convert.ToInt32(SpID), ColIndex, dgv_Panchang);
- }
- }
- }
- else
- {
- return;
- }
- }
- else if (dgv_Panchang.CurrentCell.ColumnIndex == 4)
- {
- //try
- //{
- Cls_Global_Var.Name = string.Empty;
- Cls_Global_Var.Name = cmbBox.SelectedItem.ToString();
- if (Cls_Global_Var.Name != string.Empty && Cls_Global_Var.Name != null)
- {
- Cls_Global_Var.StrSql = string.Empty;
- Cls_Global_Var.StrSql = "select Pk_SpecialDay from tbl_specialday where V_Title ='" + Cls_Global_Var.Name + "'";
- SpID = Cls_DataBase.GetIdentCurrentID(Cls_Global_Var.StrSql);
- if (SpID != null)
- {
- int RowIndex = dgv_Panchang.CurrentCell.RowIndex;
- int ColIndex = dgv_Panchang.CurrentCell.ColumnIndex;
- DataGridViewCell dgvCurrent = dgv_Panchang[ColIndex + 2, RowIndex];
- if (dgvCurrent != null)
- {
- dgv_Panchang.CurrentCell = dgvCurrent;
- dgv_Panchang.CurrentRow.Cells["SPDValue"].Value = SpID;
- Cls_PanchangMaster_Obj.GetSpecialDayName(Convert.ToInt32(SpID), ColIndex, dgv_Panchang);
- }
- }
- }
- //}
- //catch (Exception ex)
- //{
- // Cls_GlobalMessage.CreatErrorLog(ex.Message.ToString());
- //}
- }
- }
- }
- catch (Exception ex)
- {
- Cls_GlobalMessage.CreatErrorLog(ex.Message.ToString());
- }
- finally
- {
- dgv_Panchang.ClearSelection();
- dgv_Panchang.EndEdit();
- }
- }