| re: How do I get control of a list box outside of the namespace from a class
Is WindowsApplication2 really a completely seperate second application? Do you have one application trying to access the listbox of a totally different application? Or just one class trying to access the listbox of a different class? One form trying to access the listbox of another form?
It really isnt' a good plan to have your class CRYPTO being tightly tied to the UI controls. It makes it a bear to update and make changes later.
Better to have CRYPTO raise an event that your UI is subscribed to. When crypto raises an event with the string as part of its arguments, then the form with the listbox can receive the event and react accordingly.
Think of it this way... The UI has only one purpose: User Interface. Your crypto class has only one purpose: Do cryptography. When crypto is done it should raise it's hand and yell out the answer. The UI can react as it needs to. But crypto doesn't need to understand what UI does, or even how many other classes are listening. You could have 10 classes all listening for crypto to finish and yell the answer. One does the listbox... one sends the answer over a socket connection... one stops a method timer... one logs the action... You wouldn't want to make your crypto class do all those other things explicitly.
|