I have a dilemma.
I have a program that I was able to compile and run successfully when I first unzipped the files, but the buttons used to do frame acquisition were hidden off to the side.
After I started making changes (I did NOT actually modify the code in any way, just removed some references from the project that were not in use), a formerly functional line of code starts being the focal point for System.NullReferenceException.
public frmMain()
{
// Required for Windows Form Designer support
InitializeComponent();
splash.Show();
splash.Refresh();
serComm.SynchronizingObject = this;
serComm.commEvent += new CommDelegate(DataIsHere);
//input on RI is from the ECG
serComm.RI_Event+= new RIChangeDelegate(ExternalTrigger1);
//input on DSR is from the manual trigger button
serComm.DSR_Event+=new DSRChangeDelegate(ExternalTrigger2);
acquireTicker.Elapsed +=new ElapsedEventHandler(AcquisitionTick);
acquireTicker.SynchronizingObject=this;
acqTimeOut.Elapsed+=new ElapsedEventHandler(AcquisitionTimedOut);
acqTimeOut.AutoReset=false;
acqTimeOut.SynchronizingObject=this;
startDelay.Elapsed+=new ElapsedEventHandler(StartUpDelay);
startDelay.AutoReset=false;
startDelay.SynchronizingObject=this;
debounce.Interval=250;
debounce.AutoReset=false;
debounce.SynchronizingObject=this;
birdPinger.Elapsed+= new ElapsedEventHandler(BirdPingerTick);
birdPinger.Interval=100;
birdPinger.AutoReset=false;
birdPinger.SynchronizingObject=this;
axLEAD1.DrawPersistence=true;
}
The final line, axLEAD1, is what causes the exception.
axLEAD1 is declared in the frmMain class like so:
private AxLEADLib.AxLEAD axLEAD1;
Thinking that if I declare axLEAD1 as:
private AxLEADLib.AxLEAD axLEAD1=new AxLEADLib.AxLEAD();
Removes the Null reference exception, but I then get an 'InvalidActiveXStateException' occuring in the axinterop.leadlib.dll file.
I am really confused as to why this one line no longer works. Commenting it out 'Solves' everything, but makes the program useless, as there is no depiction of the video feed to work with.
Why is this happening, and what can I do about it?
Thanks in advance!