"object refrence is not set to an instance of an object."
Cause 1:
Not declaring variables!
Yes, I know it sounds obvious, but MAKE SURE that you've explicity declared the variable, and don't forget to use the appropriate scope!
Cause 2:
Bad scoping
public Form1()
{
private string strHello;
}
private void btnOpen_Click(object sender, EventArgs e)
{
strHello = "Hello";
Textbox.Text = strHello;
}
This won't work because strHello is only accessable in Form1()
If anybody knows more please let me know, thanks.
Michael27
Junior Poster in Training
93 posts since Jul 2010
Reputation Points: 23
Solved Threads: 6
Skill Endorsements: 2
If your SQL is returning something that cannot be converted, that can be a problem.
What was the exact error you received?
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7