|
No Object Instance?
I just had a lot of help with this. This is the MOST IRRITATING thign i have ever done (Move from C++ to C#). My prog compiles fine but crashes at runtime when user hits the enter Key.
Declaration on Form:
[PHP]
DIRCClient dircClient=new DIRCClient();
[/PHP]
Overloaded Form Constructor:
[PHP]
public frmStatus(DIRCClient DircClient)
{
InitializeComponent();
dircClient=DircClient;
}
[/PHP]
Function Using Passed Object:
[PHP]
private void txtStatusInput_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter) //was enter pressed?
{
if(!dircClient.b_conStatus)
{
txtStatusWin.Text+=dircClient.s_msgErrSymbol+" not connected"+'\n';
}
else
{
txtStatusWin.Text+=txtStatusInput.Text+'\n';
txtStatusInput.Text=""; //clear the input box
}
}
}
[/PHP]
ERROR:
[PHP]
An unhandled exception of type 'System.NullReferenceException' occured
Additional Info:
Object reference not set to an instance of an object
[/PHP]
this makes no sense to me... i seem to have set it to an instance?
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"
SearchLores.org
|