Just like there is Alert there is a Confirm to get a confirm dialog box -> thisXDocument.UI.Confirm. If you want a confirm window with Yes/No buttons, here is code that can help you out
if(XdConfirmChoice.xdNo == thisXDocument.UI.Confirm(string.Format("Are you sure you want to delete?" ), XdConfirmButtons.xdYesNo))
return;
Here if the user clicked on No then the code will return without doing anything and if the user clicked Yes it will go on to the next code to delete.
Hope this helps!
Shanthi
InfoPathDev India
Shanthi Reddy