01-27-2009 11:25 AM
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
Solved! Go to Solution.
01-27-2009 11:57 AM
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
01-27-2009 12:02 PM
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
01-27-2009 12:07 PM
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
01-28-2009 02:48 AM
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
01-28-2009 09:00 PM
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
01-29-2009 07:20 AM
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