Click here to Skip to main content
15,894,405 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem about Properties Pin
kubben1-Aug-07 1:58
kubben1-Aug-07 1:58 
GeneralRe: Problem about Properties Pin
kcynic1-Aug-07 2:10
kcynic1-Aug-07 2:10 
GeneralRe: Problem about Properties Pin
kcynic1-Aug-07 2:43
kcynic1-Aug-07 2:43 
GeneralRe: Problem about Properties Pin
kubben1-Aug-07 2:46
kubben1-Aug-07 2:46 
GeneralRe: Problem about Properties Pin
kcynic1-Aug-07 3:16
kcynic1-Aug-07 3:16 
AnswerRe: Problem about Properties Pin
collapo1-Aug-07 1:59
collapo1-Aug-07 1:59 
GeneralRe: Problem about Properties Pin
kcynic1-Aug-07 2:06
kcynic1-Aug-07 2:06 
AnswerRe: Problem about Properties Pin
Martin#1-Aug-07 2:04
Martin#1-Aug-07 2:04 
HEllo,

I think best practice would be implementing "System.ComponentModel.ISupportInitialize" in your control.
public class YourUserControl : System.Windows.Forms.UserControl, System.ComponentModel.ISupportInitialize

This interface has two methods:
BeginInit()
EndInit()

The designer will call the EndInit method at the end of InitializeComponets (means all the properties are set).
((System.ComponentModel.ISupportInitialize)(this.yourUserControl1)).EndInit();


Your UserControl just needs a boolean flag wich tells the properties when EndInit was called.
And as an init call a method which does the validation:
private bool initReady = false;

private int _aInt=0;
public int AInt
{
    get
    {
        return _aInt;
    }
    set
    {
        if(value!=_aInt)
        {
            _aInt= value;
            if(initReady)
            {
                DoStuffWithAandB();
            }
        }
    }
}

private int _bInt=0;
public int BInt
{
    get
    {
        return _bInt;
    }
    set
    {
        if(value!=_bInt)
        {
            _bInt= value;
            if(initReady)
            {
                DoStuffWithAandB();
            }
        }
    }
}

private void DoStuffWithAandB()
{
    if(AInt < BInt)
    {

    }
}

#region ISupportInitialize Member
public void BeginInit()
{
}

public void EndInit()
{
    initReady=true;
    DoStuffWithAandB();
}
#endregion


Hope it helps!

All the best,

Martin

GeneralRe: Problem about Properties Pin
kcynic1-Aug-07 2:52
kcynic1-Aug-07 2:52 
GeneralRe: Problem about Properties Pin
Martin#1-Aug-07 2:58
Martin#1-Aug-07 2:58 
AnswerRe: Problem about Properties Pin
Luc Pattyn1-Aug-07 2:37
sitebuilderLuc Pattyn1-Aug-07 2:37 
GeneralRe: Problem about Properties Pin
kcynic1-Aug-07 2:46
kcynic1-Aug-07 2:46 
GeneralRe: Problem about Properties Pin
Luc Pattyn1-Aug-07 2:59
sitebuilderLuc Pattyn1-Aug-07 2:59 
GeneralRe: Problem about Properties Pin
Malcolm Smart1-Aug-07 2:59
Malcolm Smart1-Aug-07 2:59 
GeneralRe: Problem about Properties Pin
Luc Pattyn1-Aug-07 3:42
sitebuilderLuc Pattyn1-Aug-07 3:42 
GeneralRe: Problem about Properties Pin
Malcolm Smart1-Aug-07 4:53
Malcolm Smart1-Aug-07 4:53 
AnswerRe: Problem about Properties Pin
Scott Dorman1-Aug-07 13:38
professionalScott Dorman1-Aug-07 13:38 
GeneralRe: Problem about Properties Pin
kcynic2-Aug-07 18:27
kcynic2-Aug-07 18:27 
QuestionCall To SNMP Device Pin
kaushal6541-Aug-07 1:24
kaushal6541-Aug-07 1:24 
QuestionProblem printing images on Zebra Printer Pin
Sharath Madhuranath1-Aug-07 1:22
Sharath Madhuranath1-Aug-07 1:22 
AnswerRe: Problem printing images on Zebra Printer Pin
kubben1-Aug-07 2:01
kubben1-Aug-07 2:01 
QuestionHow to optimize remove unused entries in resx ? Pin
stancrm1-Aug-07 1:20
stancrm1-Aug-07 1:20 
Questionrun application ? Pin
abcomp011-Aug-07 0:55
abcomp011-Aug-07 0:55 
AnswerRe: run application ? Pin
kubben1-Aug-07 2:02
kubben1-Aug-07 2:02 
QuestionAdding TLB to - Debug\Interop ? ? Pin
Yanshof1-Aug-07 0:51
Yanshof1-Aug-07 0:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.