Ejemplo n.º 1
0
        private void tablaDatos_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            posReg = e.RowIndex;
            btGurdarReg.Enabled = true;

            if (edicion == false)
                dirBO = -1;
            
            for (int i = 0; i < tablaDatos.Rows.Count; i++)
                if (i != e.RowIndex)
                {
                    tablaDatos.Rows[i].ReadOnly = true;
                    for (int j = 0; j < tablaDatos.Columns.Count; j++)
                        tablaDatos.Rows[i].Cells[j].Style.BackColor = Color.Gray;
                }

            if (tablaDatos.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null && nuevoReg != true && edicion == false)
                nuevoReg = true;

            if (nuevoReg == false && tablaDatos.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null && edicion != true)
            {
                bloqueOriginal = creaBloqueDatos(e.RowIndex);
                getArchivo().AbrirArchivo();
                buscaDirBloque(bloqueOriginal);
                edicion = true;
                getArchivo().CerrarArchivo();
            }
        }
Ejemplo n.º 2
0
 private void dgvThongTin_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     //if (dgvThongTin[colGia.Name, e.RowIndex].Value != null)
     //{
     //    dgvThongTin[colGia.Name, e.RowIndex].Value = dgvThongTin[colGia.Name, e.RowIndex].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty);
     //}
 }
 private void gridHeaders_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
   try
   {
     if (e.ColumnIndex >= 0 && e.RowIndex >= 0
       && gridHeaders.Columns[e.ColumnIndex].DataPropertyName == "Value")
     {
       switch ((string)gridHeaders.Rows[e.RowIndex].Cells["colName"].Value)
       {
         case "LOCALE":
           colValue.DisplayMember = "DisplayName";
           colValue.ValueMember = "Name";
           colValue.DataSource = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
             .OrderBy(v => v.DisplayName).ToList();
           break;
         case "TIMEZONE_NAME":
           colValue.DisplayMember = "DisplayName";
           colValue.ValueMember = "Id";
           colValue.DataSource = TimeZoneInfo.GetSystemTimeZones()
             .OrderBy(v => v.BaseUtcOffset.TotalHours).ThenBy(v => v.DisplayName).ToList();
           break;
         default:
           colValue.DataSource = new string[] {};
           break;
       }
     }
   }
   catch (Exception ex)
   {
     Utils.HandleError(ex);
   }
 }
Ejemplo n.º 4
0
 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (!dataGridView1.Rows[e.RowIndex].IsNewRow)
     {
         db.InjectDataBeforeCommitEvent(dataGridView1, e.RowIndex);
     }
 }
Ejemplo n.º 5
0
 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if(datePicker==null) InitializeDateTimePicker();
     //try
     //{
     if (dataGridView1.Focused && (dataGridView1.CurrentCell.ColumnIndex == 2 || dataGridView1.CurrentCell.ColumnIndex == 3))
         {
             datePicker.Location = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
             datePicker.Visible = true;
             if (dataGridView1.CurrentCell.Value != DBNull.Value)
             {
                 datePicker.Value = (DateTime)dataGridView1.CurrentCell.Value;
             }
             else
             {
                 datePicker.Value = DateTime.Today;
             }
         }
         else
         {
             datePicker.Visible = false;
         }
     //}
     //catch (Exception ex)
     //{
         //MessageBox.Show("Malformet date format: "+ex.Message);
     //}
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Checks that all required fiels are filled when the user edits a row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvNews_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (_ignore)
            {
                return;
            }
            bool allCellsOK = true;
            var row = dgvNews.Rows[e.RowIndex];
            NewsSourceType type = cbbSourceType.GetSelectedValue<Tuple<string, NewsSourceType>>().Item2;

            foreach (DataGridViewCell c in row.Cells)
            {
                if (/*c.ColumnIndex == colFilter.Index ||*/ c.ColumnIndex == colRemove.Index)
                {
                    continue;
                }
                if (c.ColumnIndex == colURL.Index && type == NewsSourceType.Twitter)
                {
                    continue;
                }
                if (c.Value == null || c.Value.ToString() == string.Empty)
                {
                    allCellsOK = false;
                    c.ErrorText = "Mandatory";
                }
                else
                {
                    c.ErrorText = string.Empty;
                }
            }
            if (!allCellsOK)
            {
                e.Cancel = true;
            }
        }
Ejemplo n.º 7
0
 /* Начало редактирование ячейки */
 private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         if ((_dataGridView.Focused) && (_dataGridView.CurrentCell.ColumnIndex == _indexColumn))
         {
             _dateTimePicker.Location = _dataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
             _dateTimePicker.Visible = true;
             if (_dataGridView.CurrentCell.Value != DBNull.Value)
             {
                 _dateTimePicker.Value = (DateTime)_dataGridView.CurrentCell.Value;
             }
             else
             {
                 _dateTimePicker.Value = DateTime.Today;
             }
         }
         else
         {
             _dateTimePicker.Visible = false;
         }
     }
     catch (Exception ex)
     {
         if (MessageBox.Show("Произошла ошибка!" + System.Environment.NewLine + "Показать полное сообщение?", "Ошибка:", MessageBoxButtons.YesNo) == DialogResult.Yes)	//Сообщение об ошибке
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Disable all domain configuration buttons when a cell begin to be editing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvDomainConfiguration_CellBeginEdit(object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e)
        {
            this.dataUpdated = true;

            this.btGenerate.Enabled = false;
            this.btUpload.Enabled   = false;
            this.btDownload.Enabled = false;
        }
Ejemplo n.º 9
0
        private void grdSelected_CellBeginEdit(object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e)
        {
            DataGridView oGrd = (DataGridView)sender;

            //Cache the current cell value.
            //If the user enters an invalid value, this cached value will be stored back into the cell.
            oGrd.Tag = oGrd.CurrentCell.Value;
        }
Ejemplo n.º 10
0
 /******************************************************************************************************************************************************/
 /***********After the spreadsheet has been created most of the program calls are made from these two functions***************/
 //These two functions were the trickiest part of the assignment. They pretty much call and moniter the entire editing process
 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs grid)
 {
     UpdateMenu();
     //Make a temp cell and set it equal to the cell passed in
     SpreadSheetCell currCell = mySheet.getCell(grid.RowIndex, grid.ColumnIndex);
     //Update the value in the cell and the index of the cell
     dataGridView1.Rows[grid.RowIndex].Cells[grid.ColumnIndex].Value = currCell.getText();
 }
Ejemplo n.º 11
0
 private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     //проверяем, чтобы было заполнена ПК группа
     if ((pKCategoryBindingSource.Current != null)
         &&((pKCategoryBindingSource.Current as PKCategory).PKCategoryNumber != 0)
         && (cbPKGroup.SelectedItem != null))
         (pKCategoryBindingSource.Current as PKCategory).PKGroup =
                 cbPKGroup.SelectedItem as PKGroup;
 }
Ejemplo n.º 12
0
 private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (dataGridView.SelectedCells.Count > 1)
     {
         MessageBox.Show("Для правки выберите только одну ячейку!");
         e.Cancel = true;
         return;
     }
 }
Ejemplo n.º 13
0
 private void dgvProcesses_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (e.ColumnIndex == 1)
     {
         if (Convert.ToString(dgvProcesses.SelectedCells[0].Value) == "")
         {
             dgvProcesses.Rows[e.RowIndex].Cells[0].Value = e.RowIndex + 1;
         }
     }
 }
        private void dataView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            _currentEditIndex = e.RowIndex;
            if(_currentEditIndex<0)
                return;

            dataView.ClearSelection();

            _savedValue = (string) dataView.Rows[_currentEditIndex].Cells[0].Value;
        }
Ejemplo n.º 15
0
 private void dgvBonusType_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     //проверяем, чтобы было заполнено название вида надбавки
     if ((bonusTypeBindingSource.Current != null)
         &&((bonusTypeBindingSource.Current as BonusType).BonusTypeName != "")
         && ((bonusTypeBindingSource.Current as BonusType).BonusTypeName != null)
         && (cbBonusSuperType.SelectedItem != null))
         (bonusTypeBindingSource.Current as BonusType).BonusSuperType =
                 cbBonusSuperType.SelectedItem as BonusSuperType;
 }
Ejemplo n.º 16
0
        private static void GridViewOnCellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            var gridView = (DataGridView)sender;

            var cell = gridView.Rows[e.RowIndex].Cells[0];
            var bindingSource = (BindingSource)gridView.DataSource;

            if (string.IsNullOrWhiteSpace(cell.Value as string))
                ((ColorerFormatSetting)bindingSource.Current).ClassificationType = string.Format("OutputColorer.{0}", Guid.NewGuid());
        }
Ejemplo n.º 17
0
 private void dataGridView1_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     //проверяем, чтобы были заполнены какие-то поля
     if ((prikazTypeBindingSource.Current != null)
         && ((prikazTypeBindingSource.Current as PrikazType).PrikazTypeName != "")
         && ((prikazTypeBindingSource.Current as PrikazType).PrikazTypeName != null)
         && (cbPrikazSuperType.SelectedItem != null))
         (prikazTypeBindingSource.Current as PrikazType).PrikazSuperType =
                 cbPrikazSuperType.SelectedItem as PrikazSuperType;
 }
Ejemplo n.º 18
0
        private void dataGridView1_CellBeginEdit_1(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (null == currSheet) { return; }

            else
            {
                DataGridViewCell gridCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                SpreadsheetEngine.Cell spreadCell = currSheet.GetCell(e.RowIndex, e.ColumnIndex);
                gridCell.Value = spreadCell.Text;
            }
        }
Ejemplo n.º 19
0
 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     Regex nums = new Regex(@"^[0123456789]*$");
     if (nums.IsMatch(dataGridView1.CurrentRow.Cells[2].Value.ToString()))
     {
     }
     else
     {
         dataGridView1.CurrentRow.Cells[2].Value = "0";
     }
 }
Ejemplo n.º 20
0
        private void dgvKBList_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            int ofs = 0, i = 0, id_cate_main = -1, h = 15 * 5;

            if (("品名" == dgvKBList.Columns[e.ColumnIndex].HeaderText) ||
                ("場所" == dgvKBList.Columns[e.ColumnIndex].HeaderText) ||
                ("メモ" == dgvKBList.Columns[e.ColumnIndex].HeaderText))
            {
                dgvKBList.ImeMode = System.Windows.Forms.ImeMode.Hiragana;
            }

            ofs = dgvKBList.RowHeadersWidth;
            for (i = 0; i < e.ColumnIndex; i++)
            {
                ofs += dgvKBList.Columns[i].Width;
            }
            if ("費目" == dgvKBList.Columns[e.ColumnIndex].HeaderText)
            {
                if (lstCateMain.Items.Count < 5)
                {
                    h = lstCateMain.Items.Count * 15;
                }

                lstCateMain.SetBounds(dgvKBList.Location.X + ofs, dgvKBList.Location.Y + dgvKBList.Rows[0].Height * (e.RowIndex + 2), 100, h);
                lstCateMain.Visible = true;
            }
            else if ("詳細" == dgvKBList.Columns[e.ColumnIndex].HeaderText)
            {
                bool entry = false;
                string str = "";
                lstCateSub.Items.Clear();

                if (null == dgvKBList.Rows[e.RowIndex].Cells["col_cate_main"].Value) return;

                id_cate_main = int.Parse(((string)dgvKBList.Rows[e.RowIndex].Cells["col_cate_main"].Value).Split(':')[0].Trim());

                foreach (CateSubRec rec in cate_sub_lst)
                {
                    if (rec.id_cate_main == id_cate_main)
                    {
                        str = String.Format("{0, 3}:{1}", rec.id, rec.name);
                        lstCateSub.Items.Add(str);
                    }
                    else if (entry)
                    {
                        break;
                    }
                }

                lstCateSub.SetBounds(dgvKBList.Location.X + ofs, dgvKBList.Location.Y + dgvKBList.Rows[0].Height * (e.RowIndex + 2), 100, h);
                lstCateSub.Visible = true;
            }
        }
Ejemplo n.º 21
0
 private void channelDgv_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
 {
     if ((e.RowIndex != -1) && (e.RowIndex != (this.channelDgv.RowCount - 1)))
     {
         string info = string.Empty;
         if (!this.ValidateRowByRowIndex(e.RowIndex, ref info))
         {
             MessageBoxUtil.ShowInfo(info);
             e.Cancel = true;
         }
     }
 }
Ejemplo n.º 22
0
 private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     //DataGridView dv = new DataGridView();
     if (e.ColumnIndex == 1)
     {
         dv.Parent = this.dataGridView1;
         dv.RowHeadersVisible = false;
         dv.Location = new Point(170, (e.RowIndex + 1) * 20);
         dv.DataSource = instance.GetDrugsByAB("A");
         dv.Show();
     }
 }
Ejemplo n.º 23
0
        private void dgvEnvironment_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
        {
            var name = dgvEnvironment.Rows[e.RowIndex].Cells[0].Value;
            var value = dgvEnvironment.Rows[e.RowIndex].Cells[1].Value;

            if (name == null && value == null)
                return;

            if (name == null || String.IsNullOrEmpty(name.ToString())) {
                dgvEnvironment.Rows[e.RowIndex].ErrorText = "Property name must not be empty!";
                e.Cancel = true;
            }
        }
Ejemplo n.º 24
0
        public static void ValidateRequiredGridCells(IWin32Window owner, 
                                                ref DataGridView gridview,
                                                ref string msg,
                                                ref DataGridViewCellCancelEventArgs e,
                                                bool showMessageBox)
        {
            DataGridViewRow row = gridview.Rows[e.RowIndex];

            if (row.DataGridView.IsCurrentRowDirty)
            {
                #region Validate each cell in row
                foreach (DataGridViewCell cell in row.Cells)
                {
                    bool isNotValid;
                    isNotValid = cell.FormattedValue.Equals(string.Empty);

                    if (isNotValid)
                    {
                        cell.ErrorText = "Can't be Empty";

                        string column = gridview.Columns[cell.ColumnIndex].HeaderText;
                        if (msg.Length == 0)
                        {
                            msg += "- " + column + ": " + cell.ErrorText;
                        }
                        else
                        {
                            msg += "\n- " + column + ": " + cell.ErrorText;
                        }
                    }
                    else
                    {
                        cell.ErrorText = string.Empty;
                    }
                }
                #endregion

                if (showMessageBox && msg.Length > 0)
                {
                    e.Cancel = true;
                    MessageBox.Show(owner, msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                foreach (DataGridViewCell cell in row.Cells)
                {
                    cell.ErrorText = String.Empty;
                }
            }
        }
 private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     // Return if its not in one of the data/file columns
     if (e.ColumnIndex < 0)
     {
         return;
     }
     PerformanceFile ctfFile = (PerformanceFile)dataGridView.Columns[e.ColumnIndex].Tag;
     // Cancel if the current value is null
     if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].FormattedValue.ToString()))
     {
         e.Cancel = true;
     }
 }
Ejemplo n.º 26
0
        private void dictionaryDataGrid_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
        {
            DataGridViewRow row = dictionaryDataGrid.Rows[e.RowIndex];

            if (e.RowIndex < dsDictionary.Dictionary.Rows.Count)
            {
                if (row.Cells[e.ColumnIndex].Value == null || row.Cells[e.ColumnIndex].Value.ToString().Length < 1)
                {
                    MessageBox.Show("Sorry you left some items in the row blank", "Error", MessageBoxButtons.OK);
                    dsDictionary.Dictionary[e.RowIndex].RejectChanges();
                    e.Cancel = true;
                }
            }
        }
Ejemplo n.º 27
0
 private void dataGridViewCellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         if (e.ColumnIndex != -1 && e.RowIndex != -1)
         {
             changed_row = ((DataRowView)dataBinding.List[e.RowIndex]).Row;
             wasChanged = true;
         }
     }
     catch (Exception ex)
     {
         Logs.WriteLine(ex.ToString());
     }
 }
Ejemplo n.º 28
0
 private void DataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     DataGridView view = (DataGridView)sender;
     DataGridViewRow row = view.Rows[e.RowIndex];
     DataGridViewColumn column = view.Columns[e.ColumnIndex];
     DataGridViewCell cell = row.Cells[e.ColumnIndex];
     if (column.DataPropertyName.Equals("password"))
     {
         if (cell.Value is string)
             lastPassword = (string) cell.Value;
         cell.Value = "";
     }
     else
         Library.Util.TrimGridCell((DataGridView)sender, e.RowIndex, e.ColumnIndex);
 }
Ejemplo n.º 29
0
 private void dgvWirelessTable_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     if (e.RowIndex == this.m_WirelessVModule.ProperName[NEResource.NE_MAIN_ANTENNA])
     {
         if (!Convert.ToBoolean(this.dgvWirelessTable[e.ColumnIndex, e.RowIndex].Value))
         {
             for (int i = 0; i < (this.dgvWirelessTable.ColumnCount - 1); i++)
             {
                 this.dgvWirelessTable[i, e.RowIndex].Value = false;
             }
             this.dgvWirelessTable[e.ColumnIndex, e.RowIndex].Value = true;
         }
         e.Cancel = true;
     }
 }
Ejemplo n.º 30
0
 private void dgvCurrentObject_CellBeginEdit(object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e)
 {
     try
     {
         if (this.editMode)
         {
             this.lblNeedToSave.Text = "The changed data has not been saved.";
             this.btnCancel.Enabled  = true;
             this.btnSave.Enabled    = true;
         }
     }
     catch (Exception exception)
     {
         System.Windows.Forms.MessageBox.Show(exception.Message, "Begin Edit Person");
     }
 }
Ejemplo n.º 31
0
		private void dgDepartmentss_RowValidating(object sender, DataGridViewCellCancelEventArgs e)
		{
			int count = 0;
			foreach (DataGridViewRow row in dgDepartments.Rows)
			{
				if (row.Cells[0].Value.ToString().ToUpper() == row.Cells[0].Value.ToString().ToUpper())
				{
					count++;
					break;
				}
			}
			if(count > 1)
			{
				MessageBox.Show("Diese Abteilung ist schon definiert", "Error",  MessageBoxButtons.OK, MessageBoxIcon.Error);
				e.Cancel = true;
			}
		}
Ejemplo n.º 32
0
 private void dgvDataList_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     string name = this.dgvDataList[e.ColumnIndex, e.RowIndex].OwningColumn.Name;
     if (!this.isCellSelected(e.RowIndex) && name.Equals("进入"))
     {
         e.Cancel = true;
     }
     if (!this.isCellSelected(e.RowIndex) && name.Equals("越出"))
     {
         e.Cancel = true;
     }
     if (!this.isCellSelected(e.RowIndex) && name.Equals("inRegion"))
     {
         e.Cancel = true;
     }
     if (!this.isCellSelected(e.RowIndex) && name.Equals("outRegion"))
     {
         e.Cancel = true;
     }
 }
Ejemplo n.º 33
0
        private void dtjwddkkehd(object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e)
        {
            Console.Write("!!!!!!!!!!!!!!!!!!!!!!!!!");
            string tmp1 = toolStripComboBox1.Text;

            dao.shenheDao s = new shenheDao();
            model.Course  c = new Course();
            c = s.find_course(tmp1);
            Console.Write("lalalal" + c.Course_num);

            List <model.Result> l = new List <model.Result>();

            num = s.selectAll2(c.Course_num);

            Console.Write(num + "555555555555555555555");
            List <model.Result> rs = new List <model.Result>();

            rs = s.selectAll1(c.Course_num);
            Console.WriteLine(c.Course_num + "33333333333333333333333333");

            DataTable dt = new DataTable("Table_New");

            dt.Columns.Add("审核编码", typeof(string));
            dt.Columns.Add("课程编号", typeof(string));
            dt.Columns.Add("课程名称", typeof(string));
            dt.Columns.Add("学生学号", typeof(string));
            dt.Columns.Add("学生姓名", typeof(string));
            dt.Columns.Add("最大人数", typeof(int));
            dt.Columns.Add("状态", typeof(string));
            foreach (model.Result r1 in rs)
            {
                model.Student d = new model.Student();
                Console.Write(r1.Student_num + "111111111111111111");
                d = s.find_student(r1.Student_num);
                Console.Write("1111111111111111111");


                dt.Rows.Add(r1.Result_num, r1.Course_num, tmp1, d.Student_num, d.Student_name, c.Maxcount, r1.State);
            }
            dataGridView1.DataSource = dt;
        }
Ejemplo n.º 34
0
 private void CurrProts_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     Random r = new Random();
     if (e.ColumnIndex == 1 || e.ColumnIndex == 3)
     {
         Main.Stats.Protectors[e.RowIndex].Name =
             "Прекъсвач за защитно изключване №" +
             Main.Stats.Protectors[e.RowIndex].Number.ToString() + " тип " +
             Main.Stats.Protectors[e.RowIndex].TypeProtector + ",  I∆n=" +
             Main.Stats.Protectors[e.RowIndex].DN.ToString() + "А";
     }
     if (e.ColumnIndex == 1 && e.RowIndex == 0)
     {
         Main.Stats.Protectors[e.RowIndex].DN = (r.Next((int)M.tempDef.DNLowest * 10, (int)M.tempDef.DNHighest * 10)) / 10;
         Main.Stats.Protectors[e.RowIndex].DT = (r.Next((int)M.tempDef.DTLowest * 10, (int)M.tempDef.DTHighest * 10)) / 10;
         Main.Stats.Protectors[e.RowIndex].MaxDN = M.tempDef.maxDN;
         Main.Stats.Protectors[e.RowIndex].MaxDT = M.tempDef.maxDT;
     }
     CurrProts.Update();
     CurrProts.Refresh();
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Validate the current row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvDomainConfiguration_RowValidating(object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e)
        {
            string domain   = string.Empty;
            string selector = string.Empty;
            string filename = string.Empty;

            // Get the domain
            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value != null)
            {
                domain = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
            }

            // Get the domain
            if (dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value != null)
            {
                selector = dgvDomainConfiguration.Rows[dgvDomainConfiguration.SelectedCells[0].RowIndex].Cells[1].Value.ToString();
            }

            // If (the domain or the selector is empty string) and the domain and selector are both empty
            if ((domain == string.Empty || selector == string.Empty) && domain != selector)
            {
                e.Cancel = true;
            }
        }
Ejemplo n.º 36
0
        //#region AddMask
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="ColumnName"></param>
        ///// <param name="HeaderText"></param>
        ///// <param name="MaskStr"></param>
        ///// <Author>Marcelo Oviedo</Author>
        //public void AddMask(string ColumnName, string HeaderText, string MaskStr)
        //{
        //    Columns.Remove(ColumnName);
        //    FwkMaskedTextColumn column_addmask;
        //    column_addmask = new FwkMaskedTextColumn();
        //    column_addmask.DataPropertyName = ColumnName;
        //    column_addmask.Name = ColumnName;
        //    column_addmask.HeaderText = HeaderText;
        //    column_addmask.maskA(MaskStr);
        //    Columns.Add(column_addmask);
        //    int j, i;
        //    string[] k = _Properties.DataColumns.Split(',');


        //    i = k.Length - 1;
        //    j = 0;
        //    while ((j < i) && (k[j].IndexOf(ColumnName) == -1))
        //    {
        //        j = j + 1;
        //    }
        //    Columns[i].DisplayIndex = j;
        //}
        //#endregion


        #region Events
        /// <param name="e">A <see cref="T:System.Windows.Forms.DataGridViewCellCancelEventArgs"></see> that contains the event data.</param>
        protected override void OnCellBeginEdit(System.Windows.Forms.DataGridViewCellCancelEventArgs e)
        {
            CurrentRow.DefaultCellStyle.BackColor = _GridProperties.RowEditedColor;

            base.OnCellBeginEdit(e);
        }
Ejemplo n.º 37
0
 protected override void OnCellBeginEdit(System.Windows.Forms.DataGridViewCellCancelEventArgs e)
 {
     base.OnCellBeginEdit(e);
     ClearLatestEditingControl();
 }
 /// <param name="e">A <see cref="T:System.Windows.Forms.DataGridViewCellCancelEventArgs"></see> that contains the event data.</param>
 protected override void OnCellBeginEdit(System.Windows.Forms.DataGridViewCellCancelEventArgs e)
 {
     CurrentRow.DefaultCellStyle.BackColor = System.Drawing.Color.Red;
     base.OnCellBeginEdit(e);
 }
 private void gridDiveProfil_CellBeginEdit(object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e)
 {
     NewRow(e.RowIndex);
 }