StrataFrame Forum

DevExpress ComboBoxEdit Population Problem

http://forum.strataframe.net/Topic6165.aspx

By Brad Vick - 1/24/2007

I have a combobox that I am attempting to load using a business object. I am getting the error below and cannot figure out how to track it down. I have done this many times before, and have other comboboxes on other forms that use this same exact population settings. It appears as though it is erroring out when attempting to find BBS.Biz.Entities.ClientsBO. I have a reference to this dll in my project. Any help tracking this problem would be appreciated.







List Population Settings:



ListPopulationSettings6.BusinessObjectType = "BBS.Biz.Entities.ClientsBO"

ListPopulationSettings6.DisplayFieldNames.AddRange(New String() {"Name", "ClientNo"})

ListPopulationSettings6.FormatString = "{0} ({1})"

ListPopulationSettings6.MethodToExecute = "FillAll;"

ListPopulationSettings6.ValueMember = "ClientKey"



Error:



1/24/2007 11:15:46 AM

Source: mscorlib

Message: Value cannot be null.

Parameter name: type

Stack: at System.Activator.CreateInstance(Type type, Boolean nonPublic)

at System.Activator.CreateInstance(Type type)

at MicroFour.StrataFrame.UI.Windows.Forms.ListControl.PopulateComboFromBusinessObject(IListControl lstControl, Object[] Parameters)

at MicroFour.StrataFrame.UI.Windows.Forms.ListControl.PopulateCombo(Control lstControl, Object[] Parameters)

at MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit.PopulateCombo(Object[] Parameters)

at MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit.Requery()

at MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit.InitializeObject()

at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()

at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)

at System.Windows.Forms.Form.OnCreateControl()

at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

at System.Windows.Forms.Control.CreateControl()

at System.Windows.Forms.Control.WmShowWindow(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Windows.Forms.ContainerControl.WndProc(Message& m)

at System.Windows.Forms.Form.WmShowWindow(Message& m)

at System.Windows.Forms.Form.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
By StrataFrame Team - 1/24/2007

Was the business object or it's namespace renamed?  That string name of the "BBS.Biz.Entities.ClientsBO" must exactly match the name of the type that the framework will try to resolve.
By Brad Vick - 1/24/2007

No. That does match. I used the population settings user interface to set this.
By Trent L. Taylor - 1/24/2007

Just for grins, have you tried to first reset the PopulationDataSourceSettings property (right-click and reset), saved, and then tried to re-create the PopulationDataSourceSettings?  It sounds like something has changed in the FullName of the object from when it was originally defined.
By Brad Vick - 1/24/2007

Yeah, a couple of times actually.



This is a new form that I just created today.



I just got it working. I have a reference to BBS.Biz.Entities in this project. But I didn't actually have a instance of a ClientsBO (or any other business object in Entities) on any forms in this project. As soon as I created an isntance of a ClientsBO, it works. BBS.Biz.Entities was not showing up in the collection loAssembly.GetReferencedAssemblies(), I guess because nothing in this project instanced any object in that namespace.
By StrataFrame Team - 1/25/2007

Yes, .NET uses a lazy loading scheme: DLLs are not loaded until an type that references them is needed.  However, it is quite strange that they did not show up in the GetReferencedAssemblies() method call... unless that call only returns the referenced assemblies that are currently loaded into the AppDomain.

If you have this problem again... say with a business object that comes from an assembly where this is the only place you're using it, you can provide the full assembly qualified type name for the type and .NET will resolve it, like this:

MicroFour.StrataFrame.Data.SqlDataSourceItem, MicroFour StrataFrame Base, Version=1.5.0.0, Culture=neutral, PublicKeyToken=SomeHexValue