[IronPython] How to find import in ipy

Brian Curtin brian.curtin at gmail.com
Thu Mar 11 18:18:13 CET 2010


On Thu, Mar 11, 2010 at 11:11, Ken MacDonald <drken567 at gmail.com> wrote:

> Hi, I have an app with a popup containing a listbox. I want to dynamically
> add a few items to the listbox and found code in a number of places which
> does something like:
>
>             listbox.Items.Add(ListItem("Special", 11))
>             listbox.Items.Add(ListItem("Regular", 19))
>
> However, I can't find the proper import so that it finds ListItem. On MSDN
> it shows as being in
>
> from System.Web.UI.WebControls import ListItem
>
> but I get "can't import UI"
>
> So, anyone know how to do this?
>
> Also, I'm concerned that next time (if I ever get it working first time) I
> come to this popup, it will contain the items I had added previously; how
> does one go about clearing the whole listbox?
> Thanks,
> Ken




Did you add a reference to it?

>>> import clr
>>> clr.AddReference("System.Web")
>>> from System.Web.UI.WebControls import ListItem
>>> ListItem
<type 'ListItem'>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100311/03956351/attachment.html>


More information about the Ironpython-users mailing list