﻿<?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?)  » Subclassing a SF ComboBox</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 28 Sep 2026 15:33:27 GMT</lastBuildDate><ttl>20</ttl><item><title>Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25271.aspx</link><description>I have subclassed a SF combo box as:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;P&gt;[codesnippet]public class ComboBox : MicroFour.StrataFrame.UI.Windows.Forms.ComboBox&lt;BR&gt;{&lt;BR&gt;}[/codesnippet]&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;However, when I use this, I get an error. Do I need to run the base code for ListPopulatingEvent (as I use this) or any other code in my subclassed control ?&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Sat, 05 Dec 2009 14:58:16 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25331.aspx</link><description>Hi Les. Many thanks for spending the time on this. I was having a problem with the Combobox on my own data , so that is why I decided to use the SF sample data and of course had to pick the one field that is not populated...it was showing the same results as my own data , so I did not check further..turns out it was showing similar results but for a different reason.&lt;P&gt;I have now investigated further and can reproduce the results with the SF sample ..but with a field that has data. The following sequence causes an error&lt;/P&gt;&lt;P&gt;[codesnippet]1. Set up the Customer Businessss Object, and set all String fields to Trim Right in the BO mapper&lt;BR&gt;2. Set up the products&amp;nbsp; Business Object as normal (i.e. dont Right Trim any of the fields)&lt;BR&gt;3. Change the field that is the source of the drop dwon (in my example I now used the prod_name field...which has data in it)&lt;BR&gt;4. Pick say the first 4 records of this table and add a few blank spaces to the end of the the prod_name &lt;BR&gt;5. Rebuild the project and test&lt;BR&gt;6. If you select an item from the drop down , and select one of the records that you have added a few blanks, two things happen that I would not have expected&lt;BR&gt;a) The drop down field itself becomes blank&lt;BR&gt;b) When you leave the drop down field, an error is thrown&lt;BR&gt;&amp;nbsp; Invalid Cast Exception was unhandled by code&lt;BR&gt;...unable to cast object of type 'ssytem.dbnull' to type system.string[/codesnippet]&lt;/P&gt;&lt;P&gt;The reason this was happening with my own data was because I had imported a table , the drop down field was 10 character string field and say it has 'ABCD' the import padded this out with 6 blanks</description><pubDate>Sat, 05 Dec 2009 14:58:16 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25326.aspx</link><description>Hi Les,&lt;br&gt;
&lt;br&gt;
Very funny! at least after the 2 hours has passed :)</description><pubDate>Fri, 04 Dec 2009 10:24:53 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25324.aspx</link><description>Hi Gerard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; A guy's walking down the street and sees a drunk down on his hands and knees under a street light. "Can I help you?" he says. "I lost my keys", the drunk says - "I dropped them down the block beside my car." "So why are you looking for them here under this street light?", the guy says. "Because the light's better here."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I spent two hours wondering why the StrataFrame combobox wasn't working. I Especially wondered why it was loading 524 blanks in the combobox! I looked at the Products table, and prod_Name contained product descriptions. Then I open the SQL Management Console and did a quick query, and slapped myself on the forehead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Problem is, prod_desc doesn't contain descriptions. It's empty. Bind to prod_Name, and it works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Thanks for the trip down memory lane (I've done this before...)&lt;/P&gt;&lt;P&gt;Les</description><pubDate>Fri, 04 Dec 2009 08:54:06 GMT</pubDate><dc:creator>Les Pinter</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25313.aspx</link><description>OK . Still having issues with ComboBox. I had Combobox working fine, move stuff over to a new server and since then I just cant get ComboBox working at all, even on original PC. So I have set up a a Test project using the Strataframe Sample Database and using SF base ComboBox.&lt;/P&gt;&lt;P&gt;Fot the purpose of the test, I have 2 Business Objects set up, Customers and Products. I have a Maintnance form with 3 fields from the Customers, and then a ComboBox which just selects out all from Products table, and I am trying to Bind this to one of the address fields.&lt;/P&gt;&lt;P&gt;At this point in time, nothing is appearing in the drop down list, or nothining is appearing in the ComboBox field as I cycle through the customers.&lt;/P&gt;&lt;P&gt;I'd apprecaiet it if somebody could have a look.... The combo boxes I am trying to use will be taking the data from another table , so thats why I have used the products table in the test...just to simulate data coming from a different BO.</description><pubDate>Tue, 01 Dec 2009 06:34:56 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25303.aspx</link><description>What is the error?</description><pubDate>Mon, 30 Nov 2009 07:50:45 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25288.aspx</link><description>Hi Guys. Thanks for getting back to me on this.&lt;/P&gt;&lt;P&gt;I am not sure now if the problem is to do with the sub-classing, as I have copied&amp;nbsp; the App and StrataFrame databases to a new server and at the same time introduced my Subclasses...and am&amp;nbsp;getting some weird results....like the Combobox has stopped working and sometimes gives an error. I will need to do some more digging to establish if it is the Sub Class or if it is something that has happeneed in the move.</description><pubDate>Thu, 26 Nov 2009 11:02:37 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25286.aspx</link><description>Hi Gerard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I have the following code in a class file (it's in VB - I have the C# if you need it):&lt;/P&gt;&lt;P&gt;Public Class MyComboBox : Inherits MicroFour.StrataFrame.UI.Windows.Forms.ComboBox&lt;/P&gt;&lt;P&gt;&amp;nbsp; Sub New()&lt;/P&gt;&lt;P&gt;&amp;nbsp; Font = New System.Drawing.Font( _&lt;BR&gt;&amp;nbsp;&amp;nbsp; "Courier New", _&lt;BR&gt;&amp;nbsp;&amp;nbsp; 9.0!, _&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Drawing.FontStyle.Regular, _&lt;BR&gt;&amp;nbsp;&amp;nbsp; System.Drawing.GraphicsUnit.Point, _&lt;BR&gt;&amp;nbsp;&amp;nbsp; CType(0, Byte))&lt;/P&gt;&lt;P&gt;&amp;nbsp; DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList&lt;/P&gt;&lt;P&gt;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;End Class&lt;/P&gt;&lt;P&gt;I can drop it on a form and it runs. What else do I need to do to reproduce your issue?&lt;/P&gt;&lt;P&gt;Les</description><pubDate>Thu, 26 Nov 2009 08:08:05 GMT</pubDate><dc:creator>Les Pinter</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25276.aspx</link><description>You shouldn't need to do anything else. What is the error?</description><pubDate>Wed, 25 Nov 2009 11:46:01 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Subclassing a SF ComboBox</title><link>http://forum.strataframe.net/FindPost25274.aspx</link><description>Here is the code for my TextEdit control that I extended:&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
using System;&lt;br&gt;
using System.Data;&lt;br&gt;
using System.Drawing;&lt;br&gt;
using System.Windows.Forms;&lt;br&gt;
&lt;br&gt;
namespace Aspire.SubclassedControls.DevEx&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public partial class TextEdit : MicroFour.StrataFrame.UI.Windows.Forms.DevEx.TextEdit&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public TextEdit()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InitializeComponent();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private void TextEdit_Layout(object sender, LayoutEventArgs e)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ((BusinessObject != null) &amp;&amp; (BindingField!=String.Empty))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Properties.AppearanceDisabled.BackColor = Color.FromName("Info");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Properties.AppearanceDisabled.ForeColor = Color.FromName("InfoText");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Properties.AppearanceReadOnly.BackColor = Color.FromName("Info");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Properties.AppearanceReadOnly.ForeColor = Color.FromName("InfoText");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private void TextEdit_Enter(object sender, EventArgs e)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (((MicroFour.StrataFrame.Business.BusinessLayer)BusinessObject).FieldDbTypes[BindingField] == DbType.String)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Properties.MaxLength = ((MicroFour.StrataFrame.Business.BusinessLayer)BusinessObject).FieldLengths[BindingField];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}[/codesnippet]&lt;br&gt;
&lt;br&gt;
Maybe this example will help.  &lt;br&gt;
&lt;br&gt;
Have a great day!&lt;br&gt;
Bill&lt;br&gt;</description><pubDate>Wed, 25 Nov 2009 10:08:43 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>