User Control Properties in Runtime 
Author Message
 User Control Properties in Runtime

Hy!

I made a UserControl. Now I want to have the Properties in RunTime which
Ive specified during Desingtime. But everytime I compile the project, my
settings are gone. How can I do this.
A small example could also be helpfull.

THX
        Ronny



Sun, 01 May 2005 21:31:58 GMT  
 User Control Properties in Runtime
Ronald,

    Where are you setting the properties?  These properties are serialized
in code in the InitializeComponent method on your control and in the form.
Are the statements that set your properties there?  Have you expanded the
code region that is hidden when checking?

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> Hy!

> I made a UserControl. Now I want to have the Properties in RunTime which
> Ive specified during Desingtime. But everytime I compile the project, my
> settings are gone. How can I do this.
> A small example could also be helpfull.

> THX
>         Ronny



Sun, 01 May 2005 22:09:55 GMT  
 User Control Properties in Runtime

To set custom properties you need to use get and  set

example
private short stopMinutes=0;

public short StopMinutes
                {
                        get
                        {
                                return stopMinutes;
                        }
                        set
                        {
                                stopMinutes=System.Math.Abs(value);
                        }
                }

You will be able to see the StopMinutes property through the designer.
You can also declare some objects as public and you can access them
using usercontrolname.propertyname

Check to see the properties are not private.

Hope it helps

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 01 May 2005 22:23:58 GMT  
 User Control Properties in Runtime
Hy!

I am setting the properties in the Property Sheet of my Control in the VS
Designer.  Let me explain a little more:
1. I made a UserControl called GridX
2. I added the control to another form
3. In this form I got a Property Sheet for GridX
4. Now I am addid Columns to GridX

That works all correct.

But when I start my Application all the Members are initialized with the
values from the GridX Class and me Columns are gone. Now I need to find a
way to save these Settings somehow. I thought about a static class attribute
in another class. But this would only work for one GridX!
It is possible, t set the Text of  a button for example during Design Time
and in RT the button knows the text. It must be possible to save my settigns
also and set them in RT.

Ronny



Sun, 01 May 2005 22:28:16 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to change DISABLED property of a CEdit control at runtime

2. Displaying property pages in a dynamically created, runtime-licensed activex control

3. How to create a runtime only property for ActiveX control

4. Get All Properties at RunTime for a Control

5. Properties of a user control displayed in designer

6. User Controls: Accessing Properties (a slightly different point of view)

7. Q: Passing values to user control properties

8. Declaring properties in a user control...

9. Horrible user control bug stripped all user controls from my project

10. Design mode control derived from runtime control...

11. Runtime error: user breakpoint called from code at ...

12. What makes a control property increment on click (VB properties window)

 

 
Powered by phpBB® Forum Software