Click here to Skip to main content
15,923,789 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
wat will i hve to do in order to not erase the record when i select the no option in message box.my codin is as written below

Dim cmd As New SqlCommand("delete from loading where loadingrefno='" & loadingrefno.Text & "'", con)
       Dim res As Integer = cmd.ExecuteNonQuery
       If res = 1 Then
           MsgBox("Are You sure you want to delete", MsgBoxStyle.YesNo, "Are You Sure")
           Exit Sub
           MsgBox("deleted succesfully")
           clear()
           AutoGenerate()
           fill()
       Else
           MsgBox("details not found")
       End If
Posted
Updated 10-Dec-11 20:02pm
v2

A message box returns the value that the user has chosen.
Try
if (MsgBox("Are You sure you want to delete", MsgBoxStyle.YesNo, "Are You Sure")==DialogResult.Yes Then
            //Delete code here
            MsgBox("deleted succesfully")
            clear()
            AutoGenerate()
            fill()
EndIf
 
Share this answer
 
Comments
[no name] 11-Dec-11 2:18am    
5!
Monjurul Habib 11-Dec-11 4:46am    
5!
Abhinav S 11-Dec-11 4:49am    
Thanks Monjurul.
Abhinav S 11-Dec-11 4:48am    
Thanks Pranit.
Rubaba 11-Dec-11 6:20am    
5+
Try the following:
VB.NET MessageBox.Show Examples
 
Share this answer
 
Comments
Abhinav S 11-Dec-11 4:49am    
Yes should help the OP. 5.
Monjurul Habib 11-Dec-11 4:55am    
thank you
Rubaba 11-Dec-11 6:20am    
5+
Monjurul Habib 11-Dec-11 7:42am    
thank you rubaba
thatraja 11-Dec-11 7:22am    
5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900