Click here to Skip to main content
15,172,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ERROR is : Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 21:
Line 22: }
Line 24:
Line 25: }

thanks in advance
Michael_Davies 28-Jul-15 5:54am
Not enough information, where is GridView1 initialised?
vivek7255 28-Jul-15 8:14am
post your complete code, we can't make out by the posted code

1 solution

We can't solve this for you: it's up to you.

Start by looking in your code, and find every reference to "GridView1".
Look to see if there is anywhere which assigns a value to that.
If there is, look at exactly what is being assigned - check that that is valid and not null. At some point, it needs to be assigned a new Gridview(... value.
If there isn't, then you need to know why not. And that means looking at the rest of your code and trying to find out what you meant to do, and what it was you did instead!

But we can't do that for you - we don't have access to your code!
Comments 28-Jul-15 9:18am
sorry i can just expose error n some code, its company company protocol can't share whole code. Grid view is already on form and data is from connected device fetch
into MySQL database and grid view is linked with database. Thanks to all for your suggestions... i my trying.

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