LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

When I execute my code that contains SetCtrlVal, I get the following error:

Solved!
Go to solution

When I execute my code that contains SetCtrlVal, I get the following error:

“Invalid argument type found double expected int.”   The variable in question is declared double, and from reading the help info, the variable should adapt to the declared type.

0 Kudos
Message 1 of 6
(4,332 Views)

The data type in your program needs to match the data type of the control.

 

Go to the UI editor and double click on the control in question.  Check the Data Type field displayed there.  It needs to match what's in your program.

0 Kudos
Message 2 of 6
(4,329 Views)

A typical reason for this error is using a wrong panel handle in SetCtrlVal: check that the handle passed to the function effectively is the one returned from LoadPanel or NewPanel function.

Another common issue it trying to address a control on a tab page using the handle of the panel that holds the tab control: you must consider that each tab page has its own panel handle as it were a separate panel; you can retrieve the handle associated with tab pages with GetPanelhandleFromTabPage () command.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 6
(4,325 Views)

I have checked that again, and the numeric control is declared as double.

0 Kudos
Message 4 of 6
(4,324 Views)
Solution
Accepted by topic author pnesky

Then either your panel handle is wrong, as Roberto suggested, or your control constant is wrong.  Make sure that you're using a control constant by name, e.g. MAINPANEL_NUMERIC, and not a literal number, e.g. 2.

 

Also make sure that your have the order of the parameters correct.  For example:

SetCtrlVal (panelHandle, PANEL_CONTROL_ID, value2set);

 

If you could post your code, this should be a quick fix.

0 Kudos
Message 5 of 6
(4,321 Views)

Using GetPanelHandleFromTabPage did the trick!  thanks alot.

0 Kudos
Message 6 of 6
(4,319 Views)