1、在CurrentChanged事件设置代码:
DataTables("表名").Save()
这样换行的时候,就会保存。
2、在BeforeSaveDataRow设置代码:
if e.DataRow.IsNull("货品编号") OrElse e.DataRow.IsNull("单位") Then
e.Cancel = True
messagebox.show("货品编号、单位不能为空")
End If