private void c1FlexGrid1_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e) { if (c1FlexGrid1.Cols[e.Col].Name == "打印宽度") { string text = ((TextBox)((C1.Win.C1FlexGrid.C1FlexGrid)sender).Editor).Text.Trim(); try { if (text == null || text.Length == 0) { MessageBox.Show(Properties.Resources.SpaceError, Properties.Resources.HintCaption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cancel = true; } else { int value = int.Parse(text); if (value >= 10 && value <= 60) { return; } else { MessageBox.Show(Properties.Resources.InputLimit + " 10~60 ", Properties.Resources.HintCaption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cancel = true; } } } catch { MessageBox.Show(Properties.Resources.ErrChar, Properties.Resources.HintCaption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); e.Cancel = true; } } }
private void c1FlexGrid1_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e) { //if (c1FlexGrid1.Cols[e.Col].Name == "人工编号") //{ // if (c1FlexGrid1.Editor.Text == "") return; // else // { // if (GlobalData.TestNo == "") GlobalData.TestNo = GetAutoNumber(); // c1FlexGrid1.Rows[e.Row]["自动编号"] = GetAutoNumber();// GlobalData.TestNo + dec.ToString(); // } //} //if (c1FlexGrid1.Cols[e.Col].Name == "实验结果") //{ // if (GlobalCofigData.SystemConfig.TestType == TestTypes.摩擦感度) // { // GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.PrepareH0; // } // else // { // GlobalCofigData.SystemConfig.SerialNo = GlobalCofigData.SystemConfig.SerialNo + 1; // if( c1FlexGrid1.Rows[e.Row]["实验结果"].ToString()=="发火") GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance + GlobalCofigData.SystemConfig.Step ; // else GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance - GlobalCofigData.SystemConfig.Step; // } //} }
// by default, the grid will show DBNulls as grayed checkboxes, but // once you change them it will toggle between true and false (like a good bool!) // // if you want to allow null values in the table, use a routine like this // one and assign the underlying value directly: // private void _flex_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e) { if (!_chkAllowNulls.Checked) { return; } if (_flex.Cols[e.Col].DataType == typeof(bool)) { e.Cancel = true; if (_flex[e.Row, e.Col].Equals(false)) { _flex[e.Row, e.Col] = true; } else if (_flex[e.Row, e.Col].Equals(true)) { _flex[e.Row, e.Col] = DBNull.Value; } else if (_flex[e.Row, e.Col].Equals(DBNull.Value)) { _flex[e.Row, e.Col] = false; } } }
private void c1FlexGridFeeDetails_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e) { }