Enum Replacement Character


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

While the EnumSeparatePascalCase handles many situations it would be nice to be able to specify a substitution character like an underscore that could be used to insert spaces when displaying a enum. For example in our organization all departments are represented by a three character abbreviation and I have an enum that looks like:

 

Public Enum UserType

    HRA_Employee  

    HSA_Employee  

    Other_County_Employee  

    Community_Partner  

    Contractor  

    Vendor  

End Enum

 

Since I can’t separate all of them on PascalCase I end up inserting underscores. This works but it would make the application cleaner if I could easily eliminate the underscores when displaying the information.

Replies
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Any plans on adding this capability to the situation where an enum is bound to a text box control? Right now the "unformatted" enum is displayed.

-Larry

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Not right now.  You could, however, accomplish this by creating your own EnumTextBox subclass and within the constructor, add a handler to the this.DataBindings.CollectionChanged event.  Within this event, add a handler to the binding object's Format event.  Within the format handler, call the MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue() method and change the event args.  This will allow you to format the data going to the control.

If you want to allow the text box to be editable, then you'll also need to handle the Parse event of the binding object to reverse the process of the format event handler.

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