# Add elements in an enum with code

**URL:** <https://www.dynamicsuser.net/t/add-elements-in-an-enum-with-code/15274>\
**Category:** Developer Forum\
**Created:** [April 27, 2005, 7:55am UTC](https://www.dynamicsuser.net/t/add-elements-in-an-enum-with-code/15274 "2005-04-27T07:55:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vince](https://www.dynamicsuser.net/u/vince)\
**Post date:** [April 27, 2005, 7:55am UTC](https://www.dynamicsuser.net/t/add-elements-in-an-enum-with-code/15274/1 "2005-04-27T07:55:48Z")

</div>

Hi, I think it’s an easy question but I don’t know how to do… I have created a base enum and I would like to put new elements in this enum using code. I’d like to fill this enum with the custGroup of the clients because I’d like to create a form with a combo box that displays all the existing custGroup. At the end, the user just wil have to choose a custGroup and a report will be generated. Thanks, Vince

---

<div class="post-metadata">

**Author:** ![kashperuk](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@kashperuk](https://www.dynamicsuser.net/u/kashperuk)\
**Post date:** [April 27, 2005, 11:29am UTC](https://www.dynamicsuser.net/t/add-elements-in-an-enum-with-code/15274/2 "2005-04-27T11:29:37Z")

</div>

if I understood the task right, I think you are going the wrong way. You should simple use an unbound ComboBox (AutoDeclaration = true) and fill it on init with all needed custGroups: //FormComboBoxControl box; //you don’t need to declare a variable, because it is autodeclared - name of the variable = name of the control. box.add(“CustGroup”); and loop this add() for all custGroups then select the result box.getText(box.selection()); and if you need just custGroups, why not put a StringEdit with EDT set to CustGroup?? It will have a lookup of custGroups

---

<div class="post-metadata">

**Author:** ![vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vince](https://www.dynamicsuser.net/u/vince)\
**Post date:** [April 27, 2005, 12:39pm UTC](https://www.dynamicsuser.net/t/add-elements-in-an-enum-with-code/15274/3 "2005-04-27T12:39:53Z")

</div>

As usual, thanks Ivan .[:D]
