﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Custom Data Type issue</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Fri, 11 Sep 2026 17:11:56 GMT</lastBuildDate><ttl>20</ttl><item><title>Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23528.aspx</link><description>I try to use the Custom Data Type, but is getting stuck in some kind of Casting error.&lt;/P&gt;&lt;P&gt;I have a numeric field that is the STATUS (Active or Passive) in my Customer record. &lt;/P&gt;&lt;P&gt;I have made the following Enum definition&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;enum&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;StatusType&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;Aktiv = 0,&lt;BR&gt;Passiv = 1&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;When using the ComboBox compononent everything is working ok.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;In step two I would like to set&amp;nbsp;the "Custom Data Type" in the BOM to the "StatusType" definition. Adding the datatype seems to go fine and the IDE is working correctly when adding a default value&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.tr_status = &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;StatusType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;.Aktiv;&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size=2&gt;When I run the application - open the maintainance form for the CustomerBO, I receive the following error&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;"InvalidCastException: Specified cast is not valid"&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp; return&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; (mbs2.Business.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;StatusType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.CurrentRow[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"tr_status"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;];&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;Can someone explain me what might be wrong here, thanks!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;I need to mention that when I search for the Class Type in the BOM I receive an error saying that it "Could not gather enums for Strataframe Inherited UI" and then it fails on "DevExpress.xxxxxx.v8.1".&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;I have v7.1 installed!!!!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;Best regards&lt;BR&gt;Ulrik Mueller (Denmark)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Exception&lt;BR&gt;&amp;nbsp; Could not gather enums for MicroFour StrataFrame Inherited UI&lt;BR&gt;ReflectionTypeLoadException&lt;BR&gt;&amp;nbsp; Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.&lt;BR&gt;&amp;nbsp; LoadExceptions:&lt;BR&gt;&amp;nbsp; FileNotFoundException&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Could not load file or assembly 'DevExpress.XtraEditors.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1' or one of its dependencies. The system cannot find the file specified.&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Wed, 17 Jun 2009 16:13:26 GMT</pubDate><dc:creator>Ulrik Mueller</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23563.aspx</link><description>Thanks for your kind comments, too, by the way! :D</description><pubDate>Wed, 17 Jun 2009 16:13:26 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23562.aspx</link><description>Cool :cool: glad you got it going.  As for a grid, there is no such thing as a fast, fun, and [i]easy[/i] way to go.  But the two I would recommend would be the Infragistics UltraGrid and the DevExpress grid, in that order.  I think that the Infragistics controls, especially teh grid, are better over all.&lt;br&gt;
&lt;br&gt;
Remember that you will have to use the BusinessBindingSource to bind to any grid.</description><pubDate>Wed, 17 Jun 2009 16:12:54 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23561.aspx</link><description>It is now working perfectly - thanks a million.&lt;/P&gt;&lt;P&gt;Which DATAGRID do you recommend if grid-editing is a must ??&lt;/P&gt;&lt;P&gt;I have experimented with the VS standard DataGridView, but don't find it as easy to use together with the StrataFrame setup.&lt;/P&gt;&lt;P&gt;Again - thanks for a super support on a super framework&lt;/P&gt;&lt;P&gt;/Ulrik</description><pubDate>Wed, 17 Jun 2009 15:48:10 GMT</pubDate><dc:creator>Ulrik Mueller</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23550.aspx</link><description>Correct.  That is what a smallint will be typed as.  Just recast it as an int and you will be fine.</description><pubDate>Wed, 17 Jun 2009 10:38:45 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23549.aspx</link><description>It looks like it's seeing it as a SHORT in the debugger!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;this.CurrentRow["tr_status"]&amp;nbsp;0&amp;nbsp;object {short}&lt;BR&gt;</description><pubDate>Wed, 17 Jun 2009 10:37:59 GMT</pubDate><dc:creator>Ulrik Mueller</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23548.aspx</link><description>Yes.  Enums, by default, are typed as int.  You can manually cast this, though:&lt;br&gt;
&lt;br&gt;
[codesnippet](mbs2.Business.StatusType)((int)this.CurrentRow["tr_status"]);[/codesnippet]</description><pubDate>Wed, 17 Jun 2009 10:35:31 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23547.aspx</link><description>In the database tr_status is a SmallInt - could that be the problem ?</description><pubDate>Wed, 17 Jun 2009 10:34:33 GMT</pubDate><dc:creator>Ulrik Mueller</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23545.aspx</link><description>What type is tr_Status?  How is it defined in the database and what it the type in the CurrentDataTable when it comes back?</description><pubDate>Wed, 17 Jun 2009 09:54:47 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23544.aspx</link><description>OK - I had the Inherited UI in my project and after this have been removed from the REFERENCES I don't get the DevExpress error any more!!&lt;/P&gt;&lt;P&gt;I still have the error when opening the form containing the Custome Data Type&lt;/P&gt;&lt;P&gt;"InvalidCastException: Specified cast is not valid"&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp; return&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; (mbs2.Business.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;StatusType&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.CurrentRow[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"tr_status"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;];&amp;nbsp;&amp;nbsp; &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000&gt;Do I have to set anything special on the ComboBox properties when using a CDT'ed field.&amp;nbsp; The BindingField is still pointing to the field "tr_status". (PopulationEnumName=StatusType&amp;nbsp; PopulationType=Enumeration)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#000000&gt;Regards&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;/Ulrik&lt;/FONT&gt;</description><pubDate>Wed, 17 Jun 2009 09:24:22 GMT</pubDate><dc:creator>Ulrik Mueller</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23541.aspx</link><description>If you are referencing the MicroFour StrataFrame Inherited UI, then that is a DevExpress wrapper.  This class is never touched outside of itself.  So if you are receiving an exception through this class (the stack trace supplied) then the DevExpress control is in the formula at some point.  You might double check that this is the case.</description><pubDate>Wed, 17 Jun 2009 08:31:18 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23538.aspx</link><description>I only use Strataframe controls&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ComboBox control is a MicroFour.StrataFrame.UI.Windows.Forms.ComboBox&lt;/P&gt;&lt;P&gt;The DevExpress package is not being used in this project!!</description><pubDate>Wed, 17 Jun 2009 07:48:54 GMT</pubDate><dc:creator>Ulrik Mueller</dc:creator></item><item><title>RE: Custom Data Type issue</title><link>http://forum.strataframe.net/FindPost23532.aspx</link><description>Do you receive the same error if you use the standard StrataFrame combobox?  It appears that you have several potential issues here.  So let's remove some things from the mix.  If you use a standard StrataFrame combo, does the error persist?  In other words, remove any Inherited UI elements from the formula and let's see if you the problem continues.</description><pubDate>Wed, 17 Jun 2009 07:15:20 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>