For Each dt As DataTable In DataTables If dt.HasChanges Then Dim Result As DialogResult Result = MessageBox.Show("是否保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then DataTables.save Exit For End If End If Next