三层异常处理

扫码查看
Middle Tier (invoice.cs) private string _fname;public string fname { set { if (value.Length == 0) { throw new Exception("Please Enter the Valid Name"); } _fname = value; } get { return _fname; } } 怎么做,请帮助。 我尝试了什么: i试图在UI中获取异常how to do this , help is appreciated.What I have tried:i have tried putting to get the exception in UI which do not work推荐答案你的代码会变成这样的:Your code would become something like this:public void getdata(invoice objinvoice) { try { objinvoice.fname = fname.Text; } catch (Exception ex) { lblMessage.Text = ex.Message; } } lblMessage 是一个标签控制,您可以用几乎任何可以显示文本的东西替换它。lblMessage is a Label control, you can replace it with pretty much anything that can display text. 这篇关于三层异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-23 09:20
查看更多