Ger Cannoll
|
|
Group: StrataFrame Users
Posts: 430,
Visits: 507
|
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. 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 1. Set up the Customer Businessss Object, and set all String fields to Trim Right in the BO mapper 2. Set up the products Business Object as normal (i.e. dont Right Trim any of the fields) 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) 4. Pick say the first 4 records of this table and add a few blank spaces to the end of the the prod_name 5. Rebuild the project and test 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 a) The drop down field itself becomes blank b) When you leave the drop down field, an error is thrown Invalid Cast Exception was unhandled by code ...unable to cast object of type 'ssytem.dbnull' to type system.string 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
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Les, Very funny! at least after the 2 hours has passed
Edhy Rijo
|
|
|
Les Pinter
|
|
Group: Forum Members
Posts: 43,
Visits: 213
|
Hi Gerard, 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." 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. Problem is, prod_desc doesn't contain descriptions. It's empty. Bind to prod_Name, and it works fine. Thanks for the trip down memory lane (I've done this before...) Les
|
|
|
Ger Cannoll
|
|
Group: StrataFrame Users
Posts: 430,
Visits: 507
|
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. 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. 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. 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.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
|
|
|
Ger Cannoll
|
|
Group: StrataFrame Users
Posts: 430,
Visits: 507
|
Hi Guys. Thanks for getting back to me on this. I am not sure now if the problem is to do with the sub-classing, as I have copied the App and StrataFrame databases to a new server and at the same time introduced my Subclasses...and am 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.
|
|
|
Les Pinter
|
|
Group: Forum Members
Posts: 43,
Visits: 213
|
Hi Gerard, I have the following code in a class file (it's in VB - I have the C# if you need it): Public Class MyComboBox : Inherits MicroFour.StrataFrame.UI.Windows.Forms.ComboBox Sub New() Font = New System.Drawing.Font( _ "Courier New", _ 9.0!, _ System.Drawing.FontStyle.Regular, _ System.Drawing.GraphicsUnit.Point, _ CType(0, Byte)) DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList End Sub End Class I can drop it on a form and it runs. What else do I need to do to reproduce your issue? Les
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
You shouldn't need to do anything else. What is the error?
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
Here is the code for my TextEdit control that I extended:
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace Aspire.SubclassedControls.DevEx
{
public partial class TextEdit : MicroFour.StrataFrame.UI.Windows.Forms.DevEx.TextEdit
{
public TextEdit()
{
InitializeComponent();
}
private void TextEdit_Layout(object sender, LayoutEventArgs e)
{
if ((BusinessObject != null) && (BindingField!=String.Empty))
{
Properties.AppearanceDisabled.BackColor = Color.FromName("Info");
Properties.AppearanceDisabled.ForeColor = Color.FromName("InfoText");
Properties.AppearanceReadOnly.BackColor = Color.FromName("Info");
Properties.AppearanceReadOnly.ForeColor = Color.FromName("InfoText");
}
}
private void TextEdit_Enter(object sender, EventArgs e)
{
if (((MicroFour.StrataFrame.Business.BusinessLayer)BusinessObject).FieldDbTypes[BindingField] == DbType.String)
{
Properties.MaxLength = ((MicroFour.StrataFrame.Business.BusinessLayer)BusinessObject).FieldLengths[BindingField];
}
}
}
}
Maybe this example will help. Have a great day! Bill
|
|
|
Ger Cannoll
|
|
Group: StrataFrame Users
Posts: 430,
Visits: 507
|
I have subclassed a SF combo box as: public class ComboBox : MicroFour.StrataFrame.UI.Windows.Forms.ComboBox { } 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 ?
|
|
|