# How to acces the Application's control in Iron Ruby script

**URL:** <https://www.ruby-forum.com/t/how-to-acces-the-applications-control-in-iron-ruby-script/206531>\
**Category:** IronRuby\
**Created:** [May 4, 2011, 8:23am UTC](https://www.ruby-forum.com/t/how-to-acces-the-applications-control-in-iron-ruby-script/206531 "2011-05-04T08:23:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 4, 2011, 8:23am UTC](https://www.ruby-forum.com/t/how-to-acces-the-applications-control-in-iron-ruby-script/206531/1 "2011-05-04T08:23:07Z")

</div>

Hi All,

I’m trying to do the same in IronRuby that I have done in IronPython  
script, but its throwing some exception as undefine constant. I dont  
know how to achieve it Iron Ruby.

In Puthon I will access the control that is placed in the applicatoin  
and set its source in the Script itself. But in Ruby I dont know how to  
do it.  
Can any one help me to achieve this.

-Sri.

Python Code :

List = Application.FindName(‘MyListBox’)  
List.ItemsSource = MyObject

While using the same in IronRuby its throwing exception as undefined  
constant “Application”.

---

<div class="post-metadata">

**Author:** ![sriyas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@sriyas](https://www.ruby-forum.com/u/sriyas)\
**Post date:** [May 4, 2011, 2:11pm UTC](https://www.ruby-forum.com/t/how-to-acces-the-applications-control-in-iron-ruby-script/206531/2 "2011-05-04T14:11:11Z")

</div>

Hi Sri,

I assume that you are trying to work from a wpf application…  
in Ruby, variables that start in upper case are interpreted as  
constants…

Did you try?

list = self.FindName(‘MyListBox’)  
list.ItemsSource = myObject

(note the lower case names)…

Regards,

Eduardo B.

Sridharan Sivamurugan wrote in post #996532:

> Hi All,
> 
> I’m trying to do the same in IronRuby that I have done in IronPython  
> script, but its throwing some exception as undefine constant. I dont  
> know how to achieve it Iron Ruby.
> 
> In Puthon I will access the control that is placed in the applicatoin  
> and set its source in the Script itself. But in Ruby I dont know how to  
> do it.  
> Can any one help me to achieve this.
> 
> -Sri.
> 
> Python Code :
> 
> List = Application.FindName(‘MyListBox’)  
> List.ItemsSource = MyObject
> 
> While using the same in IronRuby its throwing exception as undefined  
> constant “Application”.
