How to access from objects from other class
-
In form i have different object (like picturebox),i want to acces these object from another class for example class1
This is essentially the same question you asked before[^] and the results will be the same because the object you are trying to access is not instantiated because you are not fully instantiating the form the object comes from. So far you have not told us the overall goal of your application is, of even this part of the application. I think that there is a better way to do what you are trying to do because from the description you have supplied so far I cannot invisage that the application is designed very well.
*** Developer Day 4 in Reading, England on 2nd December 2006 - Registration Now Open *** Upcoming Scottish Developers events: * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog
-
In form i have different object (like picturebox),i want to acces these object from another class for example class1
Accessing an object properties or methods from another form is unallowed in a direct way. This is because when the compiler creates those objects, they are declared as private so u can not access it from outside the scope where it is created. u can pass over this in one solution, this is by definning some public function in that form tha do the actions u need in the properties of those objects. And u should pass a reference of the first form to the second form through the constructor of the second form. hope it helps. best regards Jamil Abou Khalil
-
In form i have different object (like picturebox),i want to acces these object from another class for example class1
signimage wrote:
In form i have different object (like picturebox),i want to acces these object from another class for example class1
The default access/visibility level of the form's objects is
private
. To use your form's objects in another class, you have to change its access level fromprivate
topublic
(or what is more appropriate) through its Modifiers property.________________________________ Success is not something to wait for, its something to work for.
-
In form i have different object (like picturebox),i want to acces these object from another class for example class1
you should declare object public in partial class and formName.objectName acces object .