VC++ to C#.NET

B

Bob C.

Hi All,

I was working on MFC ActiveX controls using VC++. Now i moved to C#.NET.

In MFC ActiveX we have DoPropertyExchange(), what is an equivalent to that
in C#.NET (System.Windows.Forms.UserControl)??

How do i store my control's property values and retrieve it?

Thanks,
Bob.
 
D

Daniel Pratt

Hi Bob,

Bob C. said:
Hi All,

I was working on MFC ActiveX controls using VC++. Now i moved to C#.NET.

In MFC ActiveX we have DoPropertyExchange(), what is an equivalent to that
in C#.NET (System.Windows.Forms.UserControl)??

How do i store my control's property values and retrieve it?

Thanks,
Bob.

One of the nice things about the .NET component programming model is
that you don't have to worry about saving the control's property values.
When you place a component or control onto a designer and then change a
property in the Properties window, the designer will generate code that will
set the property at runtime.

Regards,
Daniel
 
B

Bob C.

Thanks for your reply deniel...

Lets assume my control has 3 properties,

Properties are :
1. ID
2. Font
3. third

If user places my control on from, the designer genrates code as follows:
this.myControl.Font = new System.Drawing.Font(........);
this.myControl.ID=0;
this.myControl.third = somthing

But i want to Set the ID first always.... and then the rest of the
properties.
(Based on the ID's value i need to do few stuff FIRST)

How can i do achive this?

Thanks,
Bob.
 
D

Daniel Pratt

Hi Bob,

Bob C. said:
Thanks for your reply deniel...

Lets assume my control has 3 properties,

Properties are :
1. ID
2. Font
3. third

If user places my control on from, the designer genrates code as follows:
this.myControl.Font = new System.Drawing.Font(........);
this.myControl.ID=0;
this.myControl.third = somthing

But i want to Set the ID first always.... and then the rest of the
properties.
(Based on the ID's value i need to do few stuff FIRST)

How can i do achive this?

Thanks,
Bob.

I don't know how you could do the above (maybe with a component
designer), but perhaps there is an alternative. For example, if you
implement the ISupportInitialize interface on your control, the designer
will insert a call to ISupportInitialize.BeginInit() before setting the
control's properties and a call to ISupportInitialize.EndInit() afterward.

If you could give a more specific reason for needing to control the
order of property assignment, perhaps someone will have a better solution.

Regards,
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top