My ComboBox is not seeing my enum


Author
Message
Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Peter Denton (09/17/2008)
G'day

Hope this helps. I also reccomend all the enums in one class.

Peter

 

Done yesterday Smile

Peter Denton
Peter Denton
StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)StrataFrame Novice (109 reputation)
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.FormOwnerClosing

MsgBox(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

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
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 Smile
Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
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 Smile

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
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!
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Marcia,

  1. Exit VS and open the solution again and re-build, then see if it works. 
  2. 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

Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
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.

Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
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 on

loType = Type.GetType(TypeName, False, True)

returns null.

It seems that it cannot find the enum. What would cause this?


Marcia G Akins
Marcia G Akins
StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)StrataFrame User (496 reputation)
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

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
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?

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search