LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Type mismatch and VI properties in "to more specific classes"

Solved!
Go to solution

Dear All

 

 I have a subVI that tries to change the properties of some objects on main front pane, in the example I attached to this message it works well but when I am using the same subVI in my main application which is a little bit bigger and has more hierarchial levels (that is why I didn't attach that one) it comes across some errors.

After running "to more specific class" in the subVI called ("MultpObj1N") it gives this error that "LabVIEW:  Type mismatch: Object cannot be type casted to the specified type."

 

I have no clue what could be the reason for that. Do you have any idea what it could be ?

 

Best regards

 

Afshin

0 Kudos
Message 1 of 7
(4,627 Views)

Change all your strict control reference constants to non-strict...for example, in one of your cases, you're using To More Specific Class to cast to the "Slide (strict)" class.  Change that to the "Slide" class.  Do the same for all the other "strict" constants.  I'm guessing you created those from terminals instead of just dropping a Class Specifier Constant and manually changing the type.

 

Anyway, this should fix the problem.

 

-D

0 Kudos
Message 2 of 7
(4,617 Views)

Dear Darren

 

Actually I need to keep it as strict because it makes it possible to access to all properties of my objects! The thing is that it works as the way it is but I don't know what is wrong in my main application which makes this error

 

Regards

Afshin

0 Kudos
Message 3 of 7
(4,611 Views)

If you change the Class Specifier Constant from "Slide (strict)" to "Slide" you'll still have access to all the properties of the Slide class.  The "strict" is basically including the data type in your control reference.  I'm guessing that you're passing in a control reference for something of the same class, but a different data type, when you're running from the main application. 

 

-D

Message 4 of 7
(4,608 Views)

Dear Darren

 

For example, if I change it to non-stric type then for boolean for instance I can not assign a constant boolean to its value and setting it on and off unless there is a trick wihch I am not aware of. I even made a refernce to my objects and created a constant from that refernce but still does not work.

 

BR

Afshin

0 Kudos
Message 5 of 7
(4,582 Views)

The non-strict class still has a "Value" property, it's just a variant instead of the actual data type.  You can wire a boolean constant to that variant and it will still work fine.

 

Are you still having the class type mismatch errors after following my suggestion?

 

-D

0 Kudos
Message 6 of 7
(4,565 Views)
Solution
Accepted by topic author Af_Dk

Dear Darren

 

Suddenly I realized that my problem just happens with cluster objects (not the charts) and as you told their data type were different. Since I just wanted to access the visibility as you suggested I changed the strict form to normal one and it worked.

Thank you for your guidance! 

 

BR

Afshin

0 Kudos
Message 7 of 7
(4,549 Views)