Marcia G Akins
|
|
Group: StrataFrame Users
Posts: 322,
Visits: 529
|
Hi All. I must have taken my stupid pills today because this should be simple. My enum is defined in the form like this: public enum Months : int { January = 1, February = 2, March = 3, April = 4, May = 5, June = 6, July = 7, August = 8, Spetember = 9, October = 10, November = 11, December = 12 };The combo box is set up like this: this.cboyearend_mth.BindingField = "yearend_mth";this.cboyearend_mth.BusinessObject = this.boPlan_hdr;this.cboyearend_mth.BusinessObjectEvaluated = true;this.cboyearend_mth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;this.cboyearend_mth.FormattingEnabled = true;this.cboyearend_mth.Location = new System.Drawing.Point(120, 162);this.cboyearend_mth.Name = "cboyearend_mth";this.cboyearend_mth.ParentContainer = this;this.cboyearend_mth.PopulationType = MicroFour.StrataFrame.UI.ListPopulationType.Enumeration;this.cboyearend_mth.PopulationEnumName = "Trinity.Forms.Months";this.cboyearend_mth.Size = new System.Drawing.Size(121, 21);this.cboyearend_mth.TabIndex = 13;But when I run the form, nothing shows up in the drop down list. I have no idea what the problem could be.
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
Try changing: this.cboyearend_mth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; to this.cboyearend_mth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; Any difference?
|
|
|
Marcia G Akins
|
|
Group: StrataFrame Users
Posts: 322,
Visits: 529
|
Bill Cunnien (09/16/2008)
Try changing: this.cboyearend_mth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; to this.cboyearend_mth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; Any difference? No - still no items in the list
|
|
|
Marcia G Akins
|
|
Group: StrataFrame Users
Posts: 322,
Visits: 529
|
OK - I stepped thru the code in Combobox.Requery() and I am seeing that this line in the GetReferencedAssemblies() method: '-- Try to just get the type before moving onloType = Type.GetType(TypeName, False, True)returns null. It seems that it cannot find the enum. What would cause this?
|
|
|
Marcia G Akins
|
|
Group: StrataFrame Users
Posts: 322,
Visits: 529
|
OK - Got it solved. The enum was defined in the wrong place and that is why the framework couldn't see it. Thanks for trying to help.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Marcia, - Exit VS and open the solution again and re-build, then see if it works.
- If not, try creating the Enum in a separate class file, re-build, then assign the enum to the combobox again and test.
Edhy Rijo
|
|
|
Bill Cunnien
|
|
Group: Forum Members
Posts: 785,
Visits: 3.6K
|
I second Edhy's suggestion about placing the enums in a separate class file. Glad you got it going!
|
|
|
Marcia G Akins
|
|
Group: StrataFrame Users
Posts: 322,
Visits: 529
|
Edhy Rijo (09/16/2008)
Hi Marcia, If not, try creating the Enum in a separate class file, re-build, then assign the enum to the combobox again and test. That is on my list. So far, I have only 2 enums in the project, so it will not be too hard to refactor this later after I have wowwed the client with how quick I am
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Glad you found your issue. The only time that you will generally have an issue with the VS DTE not "seeing" an enum when you know with all of your being that it should is when the AppDomain of the DTE is holding on to an older version of an assembly and will not load the newly built assembly housing the enum. This is common if the assembly is stored in the GAC and from time to time VS just doesn't want to let go for unknown reasons. But at any rate, it looks as though you were already on top of it
|
|
|
Peter Denton
|
|
Group: Forum Members
Posts: 77,
Visits: 787
|
G'day A technique I use when I'm trying to set up a lookup on an enum, is to create a variable of the enum type, then get the type of the variable, and the AssemblyQualifiedName of the type, e.g. Dim fred As CloseReason = CloseReason.FormOwnerClosingMsgBox(fred.GetType.AssemblyQualifiedName) Usually I do this in the debugger, put a breakpoint on the Msgbox line, put fred.GetType.AssemblyQualifiedName in the Watch and copy the literal value from the Watch to where I want the enum name. Especially useful wher it isn't your enum that you're trying to use. Hope this helps. I also reccomend all the enums in one class. Peter
|
|
|