# Fill Value List in .Net Custom Action From Code

**URL:** https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509
**Category:** Discussion
**Created:** [June 23, 2010, 4:27am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509 "2010-06-23T04:27:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [June 23, 2010, 4:27am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/1 "2010-06-23T04:27:24Z")

</div>

Hello,

is there a way to e.g set the Items of a ComboBox from within the Custom&nbsp;Actions .Net Code? This way I can set the items of the combobox to the strings of an Enum without manually checking that they are in sync if it changes.

Hope they is a solution for this.

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [June 23, 2010, 11:05am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/2 "2010-06-23T11:05:08Z")

</div>

Hi,   
  
 You can use ‘InvokeAssemblyMethod’ method to call a managed method from the action’s script. The method must be public and take a single string parameter.   
  
 For example:   
  
 C#   
  
 public object[] GetEnumValues(string value) {   
 return Enum.GetNames(typeof(DayOfWeek));   
 }   
  
 VBScript   
  
 InvokeAssemblyMethod(“GetEnumValues”, “”)   
  
 Regards,   
 Paul.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [June 25, 2010, 8:13am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/3 "2010-06-25T08:13:21Z")

</div>

thanks for the hint it works well, except for one thing:I can not access the members of the array.   
 Do I need to conver the array?   
  
 I have the following vbScipt code:   
  
 dim EValues   
 EValues = InvokeAssemblyMethod(“GetEnumValues”, “”)   
 for each i in EValues   
 MsgBox "Current i is " & i   
 next   
  
 It always returns a “type mismatch” error, but when debugging the script I can see that the EVAlues variable contains the correct values.   
 Best regards,   
 quirrel

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [June 28, 2010, 12:25pm UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/4 "2010-06-28T12:25:26Z")

</div>

Hi Quirrel,   
  
 Sorry, it look’s like VBScript can’t handle the array type that is being returned (works fine in Javascript). You can either switch to using Javascript, or return a string and split it in VBScript, i.e.   
  
 C#   
  
 [code]public string GetNames(string arg) { return string.Join(", ", Enum.GetNames(typeof(EnvironmentVariableTarget))); }[/code]   
  
 VBScript   
  
 [code]dim EValuesEValues = Split(InvokeAssemblyMethod(“GetNames”, “”), ", ")For Each x in EValues MsgBox xNext[/code]   
  
 Regards,   
 Paul.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [June 28, 2010, 3:35am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/5 "2010-06-28T03:35:42Z")

</div>

thanks for pointingt this out, I really thought I missed something here.   
 That one now works just fine.   
 May be you can give a final hint on how to pass a stringparameter to the c# method?   
 Calling   
 EValueName=“EProductVersionState”   
 EValues = Split(InvokeAssemblyMethod(“GetEnumValues”, EValueName), “|”)   
 throws an exception…   
 Best regards,   
 quirrel

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [June 28, 2010, 10:36am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/6 "2010-06-28T10:36:19Z")

</div>

Hi Quirrel,   
  
 Just tested it here and passing arguments works fine, I can’t see anything wrong with the code you’ve posted. What is the error that you’re getting?   
  
 Regards,   
 Paul.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [June 29, 2010, 1:37am UTC](https://www.finalbuilder.com/forums/t/fill-value-list-in-net-custom-action-from-code/1509/7 "2010-06-29T01:37:14Z")

</div>

ok, the parameter “transmission” works well, it was a problem within the method that I called Do you have a hint on how to preselect the previously selected value?
