Click here to Skip to main content
15,889,034 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Using Proxies with HttpWebRequests Pin
Member 113675538-Nov-15 4:01
Member 113675538-Nov-15 4:01 
AnswerRe: C# Using Proxies with HttpWebRequests Pin
Eddy Vluggen8-Nov-15 4:06
professionalEddy Vluggen8-Nov-15 4:06 
GeneralRe: C# Using Proxies with HttpWebRequests Pin
Member 113675538-Nov-15 4:09
Member 113675538-Nov-15 4:09 
GeneralRe: C# Using Proxies with HttpWebRequests Pin
Eddy Vluggen8-Nov-15 4:22
professionalEddy Vluggen8-Nov-15 4:22 
GeneralRe: C# Using Proxies with HttpWebRequests Pin
Member 113675538-Nov-15 4:32
Member 113675538-Nov-15 4:32 
GeneralRe: C# Using Proxies with HttpWebRequests Pin
Eddy Vluggen8-Nov-15 4:53
professionalEddy Vluggen8-Nov-15 4:53 
GeneralRe: C# Using Proxies with HttpWebRequests Pin
John Torjo8-Nov-15 19:09
professionalJohn Torjo8-Nov-15 19:09 
Questionprevent method execution on design time using attributes Pin
Gilbert Consellado7-Nov-15 15:59
professionalGilbert Consellado7-Nov-15 15:59 
Is there a way to prevent a method from execution if it is in design time or the method can only be executed at runtime.

I got this problem while creating a custom control because there is a method call in the constructor that will only work at runtime.

now at design time while designing the form and use that control, then the form will generate the error. now i tried this at the constructor of the user control

C#
public ctrl_information()
    {
        InitializeComponent();
        if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)) return;
        SomeMethod();
        //Other code
    }

what i want to achieve is something like this
C#
[ExecuteOnlyAtRuntime]
public void SomeMethod()
{
     //Code here
}

then call it like this
C#
public ctrl_information()
    {
        InitializeComponent();
        //if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)) return; -- removing this line
        //now the SomeMethod() will only be executed at runtime  not in design time
        SomeMethod();
    }

Is it possible?

Please shed some light on this.

Thank you
AnswerRe: prevent method execution on design time using attributes Pin
George Jonsson7-Nov-15 18:00
professionalGeorge Jonsson7-Nov-15 18:00 
AnswerRe: prevent method execution on design time using attributes Pin
Richard MacCutchan7-Nov-15 21:11
mveRichard MacCutchan7-Nov-15 21:11 
GeneralRe: prevent method execution on design time using attributes Pin
Gilbert Consellado8-Nov-15 1:33
professionalGilbert Consellado8-Nov-15 1:33 
AnswerRe: prevent method execution on design time using attributes Pin
OriginalGriff7-Nov-15 22:48
mveOriginalGriff7-Nov-15 22:48 
GeneralRe: prevent method execution on design time using attributes Pin
Gilbert Consellado8-Nov-15 1:35
professionalGilbert Consellado8-Nov-15 1:35 
GeneralRe: prevent method execution on design time using attributes Pin
OriginalGriff8-Nov-15 1:41
mveOriginalGriff8-Nov-15 1:41 
GeneralRe: prevent method execution on design time using attributes Pin
Gilbert Consellado8-Nov-15 3:31
professionalGilbert Consellado8-Nov-15 3:31 
GeneralRe: prevent method execution on design time using attributes Pin
Gilbert Consellado8-Nov-15 3:37
professionalGilbert Consellado8-Nov-15 3:37 
GeneralRe: prevent method execution on design time using attributes Pin
OriginalGriff8-Nov-15 4:03
mveOriginalGriff8-Nov-15 4:03 
GeneralRe: prevent method execution on design time using attributes Pin
Gilbert Consellado8-Nov-15 14:38
professionalGilbert Consellado8-Nov-15 14:38 
AnswerRe: prevent method execution on design time using attributes Pin
Nathan Minier9-Nov-15 3:18
professionalNathan Minier9-Nov-15 3:18 
Questiongdi+ shape is not a reference object in Arraylist? Pin
smallkubi7-Nov-15 5:47
smallkubi7-Nov-15 5:47 
AnswerRe: gdi+ shape is not a reference object in Arraylist? Pin
Richard MacCutchan7-Nov-15 6:14
mveRichard MacCutchan7-Nov-15 6:14 
GeneralRe: gdi+ shape is not a reference object in Arraylist? Pin
smallkubi7-Nov-15 14:01
smallkubi7-Nov-15 14:01 
GeneralRe: gdi+ shape is not a reference object in Arraylist? Pin
Richard MacCutchan7-Nov-15 21:07
mveRichard MacCutchan7-Nov-15 21:07 
AnswerRe: gdi+ shape is not a reference object in Arraylist? Pin
George Jonsson7-Nov-15 17:40
professionalGeorge Jonsson7-Nov-15 17:40 
GeneralRe: gdi+ shape is not a reference object in Arraylist? Pin
smallkubi7-Nov-15 22:06
smallkubi7-Nov-15 22:06 

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.