对象引用未设置为实例 [英] object reference not set to an instance

查看:70
本文介绍了对象引用未设置为实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码有什么问题?它给出了错误

Whats wrong with my code? It gives error

loan.Amount = Double.Parse(txtLoanAmount.Text);



请帮忙.



Please help.

推荐答案

您正尝试访问null对象的属性.
尝试通过源代码进行调试,以自行解决问题.长期来看会对您有帮助.
You are trying to access an attribute for an object that is null.
Try debugging through your source code to figure the problem by yourself. It will help you in the longer term.


您好,

也许您忘了创建该类的实例?

Hi,

Maybe you forgot to create an instance of that class?

Loan loan = new Loan();



在给定代码之前添加该代码可能会有所帮助!

问候,
爱德华



Adding that before the given code might help!

Regards,
Eduard


这篇关于对象引用未设置为实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆