Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I've Desktop application with N-Tire architecture , i want to send validation message from business layer to GUI Form to show it in MessageBox to make code more reusable and isolated.
how can i achieve this

What I have tried:

i try throw new exception , but the application crash , i just want to show message into messagebox
Posted
Updated 5-Dec-20 22:19pm

1 solution

The best way is to provide an Event in the BL DLL that the PL handles - it can then deal with the message as it sees fit.

Exceptions should not be used for "normal processing" - they are there to handle exceptional events such as errors, not for confirmations. And if they aren't handled every time your DLL is called, your app will crash - that's the whole idea!
 
Share this answer
 
Comments
Ahmed Dabas 6-Dec-20 4:49am    
can u support me with simple example , please
OriginalGriff 6-Dec-20 5:11am    
Example of what exactly?
You don't know how to create an event?
Or you don't know how to add an event handler?
Ahmed Dabas 6-Dec-20 5:25am    
i don't know how to make event fire message box
OriginalGriff 6-Dec-20 5:34am    
Please read what you wrote again.

How would you make a button click event open a message box?
Ahmed Dabas 6-Dec-20 5:45am    
No , i want catch the message that send by bl event and show it in messagebox

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