且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我该如何解决null referce变量

更新时间:2023-11-30 22:15:58

好吧尝试使用username.ToString()方法而不是username.Text 。我看到你将用户属性定义为对象,所以我认为你需要使用Tostring方法将其转换为字符串。我也看到你没有为用户名对象赋值,为对象用户名写入get并设置



username =somename;



希望对您有所帮助。
okay try using username.ToString() method rather than username.Text . i see that you define user property as object so i think you need to cast it as a string using Tostring Method. also i see that you did not assign value to the username object, write get set for object username and set

username = "somename";

hope this help to you.