I want to display messagebox with buttons whose name can be passed as parameter and return a value to the calling function respective to the button clicked
e.g. I want two buttons to be displayed as Ok and Cancel, when user clicks Ok, I want to return 0 and 1 for cancel to the calling function.
In another case, instead of Ok-Cancel, I want to pass Yes,No,Cancel as button names and return value as 0,1,2 respectively.
Is this possible in Window Forms application?
What I have tried:
I have created another form, added buttons to the form as Ok/Cancel/Yes/No/Retry/Ignore each button have its event handler and respective code for that event handler.
But I can't use single button in multiple places as it has single event handler.
Example: Form A calling this custom message box to display Yes and No. Upon Yes email will be sent, upon "No" nothing will happen. In another case, i.e. Form B calling same custom message box to use buttons Yes and No, but this Form B want to insert data into DB upon Yes button click. I.e. Different features will consume these buttons to perform different operations, which is not achieved with what I have tried.