/ Published in: VB.NET
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Me.DialogResult = Windows.Forms.DialogResult.None 'sample usage Try mybindingsource.EndEdit() en.SaveChanges() MessageBox.Show("Data successfully saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) Catch ex As Exception If ex.InnerException.ToString.Contains("PRIMARY KEY") Then MessageBox.Show("Duplicate record", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.DialogResult = Windows.Forms.DialogResult.None End If End Try