对象引用未设置为对象错误的实例 [英] Object reference not set to instance of an object error

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

问题描述

在VB.net Windows窗体中,"保存"事件 将表单的数据保存/更新到数据库,然后在事件结束时它将更新绑定到数据网格视图的数据集。但是,当 "刷新"时,代码会中断数据集
invoice_table_list。我删除并重新创建了数据集,但没有帮助。  ""Try block"刷新发票表清单时。 

In a VB.net Windows form, a "save' event  would save/update form's data to the database then at the end of the event it would update the dataset that binds to a datagridview. However the code breaks when "refresh" the dataset invoice_table_list. I deleted and re-created the dataset and it did not help. It failed on the "Try block" when refreshing invoice table list. 

尝试使用"插入代码块"插入代码它不起作用!!

try to insert the code using the "insert code block" and it did not work!!

Kahlua




推荐答案

请阅读你的帖子,试着想象一下那些不熟悉你的应用程序的人怎么可能知道发生了什么。

Please read your post and try to imagine how anyone who isn't already familiar with your application could possibly know what is happening.

听起来你的应用程序在运行时会遇到异常。如果您发布导致异常的代码,也许我们可以提供帮助。

It sounds like you are getting an exception when your application runs. If you post the code that results in the exception, perhaps we can help.

或者,只需在调试器中运行应用程序,当它因异常而停止时,将鼠标悬停在获取异常的语句上,看看它是哪个部分Null(或Visual Basic中没有任何内容)。

Alternatively, just run the application in the debugger and when it stops because of the exception, hover the mouse over the statement that gets the exception and see which part if it is Null (or Nothing in Visual Basic).


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

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