06-11-2010 03:11 PM
TestStand 4.1
C# 2008
I have added the event handler to the ExpressionEdit events as I would any event handler:
exprEdit.ButtonClick += new NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler(_ExpressionEditEvents_ButtonClickEvent);
Next, I create the Event Handler using the syntax
public void _ExpressionEditEvents_ButtonClickEvent(NationalInstruments.TestStand.Interop.UI.ExpressionEditButton btn)
{
}
I get the following error when I try to build:
Error 1 No overload for '_ExpressionEditEvents_ButtonClickEvent' matches delegate 'NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler'I assume this means that I don't have the correct parameters or types in my Event Handler declaration but it matches the Object Browser. Any ideas on what I am missing?
Solved! Go to Solution.
06-11-2010 03:21 PM - edited 06-11-2010 03:28 PM
Try removing the "Ax." from your namespace qualifier as I marked below. I think you want the one in just the UI namespace.
Edit: well not necessarily. Is your exprEdit variable declared as "NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit" or as "NationalInstruments.TestStand.Interop.UI.ExpressionEdit"?
If it is an AxExpressionEdit then I think you will want your event handler to look like this:
void exprEdit_ButtonClick(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEvent e)
-Jeff
skribling wrote:TestStand 4.1
C# 2008
I have added the event handler to the ExpressionEdit events as I would any event handler:
exprEdit.ButtonClick += new NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler(_ExpressionEditEvents_ButtonClickEvent);
Next, I create the Event Handler using the syntax
public void _ExpressionEditEvents_ButtonClickEvent(NationalInstruments.TestStand.Interop.UI.ExpressionEditButton btn)
{
}
I get the following error when I try to build:
Error 1 No overload for '_ExpressionEditEvents_ButtonClickEvent' matches delegate 'NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler'I assume this means that I don't have the correct parameters or types in my Event Handler declaration but it matches the Object Browser. Any ideas on what I am missing?
06-11-2010 03:27 PM
It is an AxExpressionEdit. Removing the .Ax results in the error:
Error 1 Cannot implicitly convert type 'NationalInstruments.TestStand.Interop.UI._ExpressionEditEvents_ButtonClickEventHandler' to 'NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler'
06-11-2010 03:29 PM
See my last edit but I think you want your event handler to look like this:
public void exprEdit_ButtonClick(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEvent e)
06-11-2010 03:34 PM
06-11-2010 03:38 PM
Glad to hear it worked. Also if you are developing in Visual Studio you should be able to use it's autocomplete feature to generate your event handler. As soon as you type += after an event you can press tab to autocomplete that line, and then press tab again for it to generate your handler with the correct prototype. I always use this to get the prototype correct and then I can come back and rename it if I want.
-Jeff
06-11-2010 03:47 PM