Click here to Skip to main content
15,922,419 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my winform application ,their are error occured on client side.that is when i clicked on menu ,button .Error like this "object reference not set to an instance of an object".

AND on my developer side machine can run same successfully opened while clicking menu and button.
but only client machine get error.please tell me solution for this.
my menuitem code like this,
private void searchToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
Search obj6 = new Search();
obj6.Show();
this.Hide();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}


and my button code is like this,
private void btnOpen_Click(object sender, EventArgs e)
{
try
{
Form1 obj3 = new Form1();
obj3.Show();
this.Hide();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

What I have tried:

i have tried try catch block to get exact problem,but still same
Posted
Updated 20-Dec-17 5:22am
Comments
Richard Deeming 20-Dec-17 11:04am    
The exception is most likely not coming from the code you've shown, but from one of the methods it's calling.

But you can't see that, because you've thrown away almost all of the exception details.

You'll need to debug your code to find out where the exception is happening, work out what's null when it shouldn't be, and then work out why.

We can't do that for you.
Member 13275563 20-Dec-17 15:02pm    
Yes exactly your right.But i have already done that code for get any exception if thier happened any null value or any.so i have tried on break point for check any exception,but thier are not any exception.
How can i get what exact problem or exception happened?? for this this error

1 solution

As mentioned in the comments, you are the only one who can fix this because we cannot run your code. And the fix is very, very simple. Debug it and find out what is null. Something that you are trying to access is null and that is where the error comes from. Then you have to determine why it is null.
 
Share this answer
 
Comments
Member 13275563 20-Dec-17 15:03pm    
Yes exactly your right.But i have already done that code for get any exception if thier happened any null value or any.so i have tried on break point for check any exception,but thier are not any exception.
How can i get what exact problem or exception happened?? for this this error
ZurdoDev 20-Dec-17 15:13pm    
You'll have to add some logging. You also need to figure out what is different on the client machine than on yours and why something would be null. If you log the full stack trace you may be able to see what is null.

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