Doing it manually would probably be better, yes, but that's exactly what I'm avoiding since I have about 50 different fields on that single table so creating them automatically saves a whole lot of work.
This is what I came up with, probably not the best solution, but it works:
VB.NET Code:
Private Sub GenericTextBox_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) If sender.Text.Length = 0 Then sender.CausesValidation = False Dim currentRow As DataRowView = TryCast(EnsaiosBindingSource.Current, DataRowView) currentRow.BeginEdit() currentRow(sender.DataBindings.Item("Text").BindingMemberInfo.BindingField) = System.DBNull.Value currentRow.EndEdit() sender.CausesValidation = True End If End Sub
Thank you for your help Kevin.




Reply With Quote