Again, you can't add the code to the method programmatically at runtime because the form needs to recompile. You CAN put the code in a prg then BindEvents to get to it.
If you're simply adding a listbox and populating it, it SHOULD work.
And I still don't see why you're doing this at runtime and then just hide the listbox when not needed. I've done this and it works fine.
>I think you're missing the question, Craig - the code isn't changing at runtime. In the form designer I will place an object, then go to the events, and put the code in there, but adding an object at runtime, like a listbox, is there nowhere I can add code that runs every time it is clicked? As in the Click event of the object in the form designer...
>
>As in something along the lines of:
>Object.Click
>do this
>do that
>do the other thing
>endobject.click
>
>Google isn't giving me anything useful. I saw proc/endproc, but nothing I could copy in and fill my stuff into, and where would I put it?
>
>The problem is I use a small SQL Select into a cursor, and the ListBox uses that doe it's data, but if I have the ListBox there already, even if it has no RowSource, or RowSourceType, I get error 1130's up the yin yang in methods that don't exist, and in lines that I have no idea where they come from. It is just nuts. Put the listbox in on hte form designer, and it bombs. Add it programatically, and it works fine. All I need is a where, and how to put a click event for it...
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer