Alex
Alex

Reputation: 11157

accessing variables from another class

i have 2 classes(a form class and a user-control class) and in the form one i have a list. I would like to access that list from the user control class. How can i do it ? i could pass a reference from the form class to the user control class , but i am curious if there is another way ?

Regards, Alexandru Badescu

Upvotes: 1

Views: 176

Answers (1)

Oded
Oded

Reputation: 499382

Passing it as a reference is your best option - this is how you should do it.

It keeps coupling between the user control and the form to a minimum and allows the user control to be used elsewhere.

Upvotes: 2

Related Questions