473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

@ design time or @ runtime ?

Hi,

Is there any kind of check like

#if DESIGNER
...
#endif

I don't want my control's OnLoad code to execute whan I drag it onto a
parent container, only when I run the application.

Thanks,

JB
Aug 4 '06 #1
4 1807
Janiek,
Yes there is (it escapes me for the moment), there's something in the
System.ComponentModel.Design namespace (i think!) that you can check. I
assume you mean behavior like the fact a listbox displays it's name
only in design mode.

Hope that points you in the right direction,
James

Janiek Buysrogge wrote:
Hi,

Is there any kind of check like

#if DESIGNER
...
#endif

I don't want my control's OnLoad code to execute whan I drag it onto a
parent container, only when I run the application.

Thanks,

JB
Aug 4 '06 #2
There is a protected property on System.ComponentModel.Component called
DesignMode, which returns true if the component is currently in design
mode. I assume your component derives from this class, so you'll be
able to access it directly in your OnLoad method.

http://msdn2.microsoft.com/en-us/lib...esignmode.aspx

pigeonrandle wrote:
Janiek,
Yes there is (it escapes me for the moment), there's something in the
System.ComponentModel.Design namespace (i think!) that you can check. I
assume you mean behavior like the fact a listbox displays it's name
only in design mode.

Hope that points you in the right direction,
James

Janiek Buysrogge wrote:
Hi,

Is there any kind of check like

#if DESIGNER
...
#endif

I don't want my control's OnLoad code to execute whan I drag it onto a
parent container, only when I run the application.

Thanks,

JB
Aug 4 '06 #3
Hi Janiek,

you can use the DesignMode property of your control or form (or any
Component).
But it doesn't work in the constructor of the Component!

hth

Christof

"Janiek Buysrogge" <J.*********@Televic.comschrieb im Newsbeitrag
news:ip********************************@4ax.com...
Hi,

Is there any kind of check like

#if DESIGNER
...
#endif

I don't want my control's OnLoad code to execute whan I drag it onto a
parent container, only when I run the application.

Thanks,

JB

Aug 4 '06 #4

Works like a charm...

Thx for the quick feedback guys.

JB

On Fri, 4 Aug 2006 11:16:05 +0200, "Christof Nordiek" <cn@nospam.de>
wrote:
>Hi Janiek,

you can use the DesignMode property of your control or form (or any
Component).
But it doesn't work in the constructor of the Component!

hth

Christof

"Janiek Buysrogge" <J.*********@Televic.comschrieb im Newsbeitrag
news:ip********************************@4ax.com.. .
>Hi,

Is there any kind of check like

#if DESIGNER
...
#endif

I don't want my control's OnLoad code to execute whan I drag it onto a
parent container, only when I run the application.

Thanks,

JB
Aug 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Danimal | last post by:
I have been using PHP for a long time... since it was called PHP/FI. I have a programming design question: Let say I have this class: class attrib { var $lenght; var $type; ... }
6
by: Code4u | last post by:
I need to design data storage classes and operators for an image processing system that must support a range of basic data types of different lengths i.e. float, int, char, double. I have a...
10
by: Matt Fielder | last post by:
I have developed a custom control to be used in my application. My application includes a form designer, so the control can be hosted while designmode for the control is either true or false,...
0
by: thivi | last post by:
hi all i am developing an user control in which i am creating a set of menu objects in a panel.. i have overriden the oncontroladded and painting. whenever i add the menu object i add it to the...
8
by: John Lee | last post by:
Hi, If I want to check permission on each public method of a web service, (assume the checking routine is ready to use and called AccessCheck) , one way of doing it is to call this AccessCheck...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
14
by: Jan Nielsen | last post by:
Hi In Microsoft Access it is possible to write code like this Sub test() DoCmd.OpenForm "TestForm", acDesign Dim a As Control For Each a In Forms("TestForm").Controls Do stuff Next End Sub
11
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
11
by: greg | last post by:
Hi all, Is there a way to get the current theme name at design time? I'm trying to write a custom control for which I need to use images from the current theme. I have asigned a theme to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.