Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r0faea705e7f83205f8420c52edda8a5473485bcd -r65fbb105db0ceec852fbf97a568cec6f8c634809 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0faea705e7f83205f8420c52edda8a5473485bcd) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 65fbb105db0ceec852fbf97a568cec6f8c634809) @@ -197,6 +197,15 @@ } /// + /// Looks up a localized string similar to De tekst mag niet leeg zijn.. + /// + public static string DataGridViewCellValidating_Text_may_not_be_empty { + get { + return ResourceManager.GetString("DataGridViewCellValidating_Text_may_not_be_empty", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De representatieve waarde die gebruikt wordt door de berekening.. /// public static string DesignVariableTypeConverter_DesignValue_Description { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx =================================================================== diff -u -r0faea705e7f83205f8420c52edda8a5473485bcd -r65fbb105db0ceec852fbf97a568cec6f8c634809 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0faea705e7f83205f8420c52edda8a5473485bcd) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 65fbb105db0ceec852fbf97a568cec6f8c634809) @@ -730,4 +730,7 @@ Het stochastisch ondergrondmodel dat voor de piping berekening gebruikt wordt. + + De tekst mag niet leeg zijn. + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -rcda9bb0707f49cfb8e685d3ec04da01240c73f26 -r65fbb105db0ceec852fbf97a568cec6f8c634809 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision cda9bb0707f49cfb8e685d3ec04da01240c73f26) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 65fbb105db0ceec852fbf97a568cec6f8c634809) @@ -165,6 +165,8 @@ { dataGridView.CurrentCellDirtyStateChanged += DataGridViewCurrentCellDirtyStateChanged; dataGridView.CellClick += DataGridViewOnCellClick; + dataGridView.CellValidating += DataGridViewCellValidating; + dataGridView.DataError += DataGridViewDataError; var nameColumn = new DataGridViewTextBoxColumn { @@ -693,6 +695,28 @@ UpdateApplicationSelection(); } + private void DataGridViewCellValidating(object sender, DataGridViewCellValidatingEventArgs e) + { + dataGridView.Rows[e.RowIndex].ErrorText = String.Empty; + + var cellEditValue = e.FormattedValue.ToString(); + if (string.IsNullOrWhiteSpace(cellEditValue)) + { + dataGridView.Rows[e.RowIndex].ErrorText = Resources.DataGridViewCellValidating_Text_may_not_be_empty; + } + } + + private void DataGridViewDataError(object sender, DataGridViewDataErrorEventArgs e) + { + e.ThrowException = false; + e.Cancel = true; + + if (string.IsNullOrWhiteSpace(dataGridView.Rows[e.RowIndex].ErrorText) && e.Exception != null) + { + dataGridView.Rows[e.RowIndex].ErrorText = e.Exception.Message; + } + } + private void ListBoxOnSelectedValueChanged(object sender, EventArgs e) { UpdateDataGridViewDataSource();