|
-
December 19th, 2006, 04:35 AM
#1
Calling Form controls from Other classes
Hi All,
Here I have some problem. my main form become too bit, It has lot of controls, And one timer is running in it, for loading and performing some tasks it is taking time, For that I want to redesign(Reaggange) my application structure,
"Mainly i want to move some controls code to different class", Is there any way of accessing Form controls from other class. Like
class Class1
{
private string text="Hello";
public void AccessFromControls()
{
button1.Text=text; //Like this
}
}
Please provide some way to proceed.
Regards
Ravi
-
December 19th, 2006, 04:47 AM
#2
Re: Calling Form controls from Other classes
Before accessing the controls from a class, that class needs to know about the instance of the form. So you will need to have a way of letting your class know that there is form existing whose controls you want to access. This can be done by having a property where you can set which Form you are going to use and then you also need to make the controls in your form public.
-
December 19th, 2006, 05:46 AM
#3
Re: Calling Form controls from Other classes
Hi
Thanks for the reply. I got it. I missed making the control as public.
Regards
Ravi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|