accessing control from a windowsform through a class file

  • Thread starter Thread starter KAMAL
  • Start date Start date
K

KAMAL

hi all,
I have some unsolving issue. i.e accessing a windowform listview in
a classfile. I want access the listview control which is placed in a window
form , with full features. Can any body helps.
Thank you.

Regards,
Kamal.
 
Which class? The form is a class... in which case you can access it
(usually) via the private field.

Outside of that scenario, I don't often advise toying with a control
outside of its parent; it usually means you are doing things in a
counter-intuitive way. I'd simply have properties / methods on the
form / control that let me get (indirect) access to the listview.
Exposing it more directly breaks a few OO ideals about encapsulation
etc.

If you *must* do it, then either make the field (eugh; slightly
better: property) public, or search by name using the Controls
collection (and Find).

Can I ask what you are trying to do? There may be a better way...

Marc
 
Back
Top