c# - Windows Forms - ErrorProvider + DataGridView -


I can do to hook ErrorProvider with individual cells on DataGridView control?

I'm not sure you can use the error provider like this, though Detagrid Views The functionality built into it is basically the same idea.

The idea is simple. A datagroup is an error text property in the scene. What do you do, you fail handle on -sel verification process and that verification, you set error text property, and you get to show the room the red error icon. Here is some pseudo-code:

  public form 1 () {this.dataGridView1.CellValidating + = new Detagrid Drishykelvalidetingiventhandlr (dataGridView1_CellValidating); } Run private void Detagrid view L_CellValidating (object sender, DataGridViewCellValidatingEventArgs e) {if (! It. Validates (e.FormattedValue)) // the cell {value.DataGridView1.Rows [e.RowIndex] value some custom validation on. E.ColumnIndex] .ErrorText = "Error"; E.Cancel = true; // user will be prevented from leaving the cell, may be that it is not the greatest idea, own that you can fix it yourself. }}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -