Numerous Popups - need help

wooglin

Member
Joined
Oct 24, 2003
Messages
7
I use the following coding, and when I select no, cancel or yes, I get the popup box several time before anything is done. Can anyone provide me a way to get the popup box to appear only one time?

Opens messagebox to make sure the user is making the appropriate change
if cancel is selected, no changes are made
If MessageBox.Show("Are you sure you want to update that record?", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) = DialogResult.Cancel Then
MessageBox.Show("Update has been cancelled!")
End If

if no is selected, no changes are made
If MessageBox.Show("Are you sure you want to update that record?", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) = DialogResult.No Then
MessageBox.Show("The record was not updated!")
End If

if yes is selected, all updates are made
If MessageBox.Show("Are you sure you want to update that record?", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) = DialogResult.Yes Then
MessageBox.Show("The record was updated!")
OleDbDataAdapter1.Update(DataSetCompleted1)
End If
 
dim RESULT as dialogresult

RESULT = messagebox.show("Are you sure you want to update that record?", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question")

select case RESULT
Case dialogresult.no
-code for no-
case dialogresult.cancel
-code for cancel-
case dialogresult.yes
-code for yes anser-
end select

now you only have it shown once
 
Back
Top