On Thu, Mar 11, 2010 at 11:11, Ken MacDonald <drken...@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'>
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com