473,699 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

if (this.DesignMod e) return ; Not working

Hi

I stumbled to this :

I have a form and in the contructor i put
if (this.DesignMod e)
return;
other code here

The IDE designer throws an exception and points to a line in the 'other
code" block .

Any reason why ?






Oct 20 '06 #1
3 17125
DesignMode is not usable in the constuctor; try putting this code (both
DesignMode and what you want to do) into a handler on the Load event.

Marc

Oct 20 '06 #2
Sagaert Johan wrote:
Hi

I stumbled to this :

I have a form and in the contructor i put
if (this.DesignMod e)
return;
other code here

The IDE designer throws an exception and points to a line in the 'other
code" block .

Any reason why ?
Hi,

Because you're in the constructor of your object, it stands to reason that
DesignMode will *not* have a value... since you're only _just_ constructing
your object, nothing will have set DesignMode.

There's another way to do it, but I cannot remember off the top of my head.
Something to do with a license manager IIRC.

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 20 '06 #3
I usually have a base class like this for forms and user controls.

public class BaseDesignModeU serControl : UserControl
{
private static readonly bool isDesignMode;

static BaseDesignModeU serControl()
{
isDesignMode =
(System.Diagnos tics.Process.Ge tCurrentProcess ().ProcessName. IndexOf("devenv ")
!= -1);
}
protected bool IsDesignMode
{
[DebuggerStepThr ough]
get
{
return isDesignMode;
}
}

}
Sagaert Johan wrote:
Hi

I stumbled to this :

I have a form and in the contructor i put
if (this.DesignMod e)
return;
other code here

The IDE designer throws an exception and points to a line in the 'other
code" block .

Any reason why ?
Oct 21 '06 #4

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

Similar topics

1
1510
by: Asad Khan | last post by:
It makes all the sense in the world, but its not working. Any idea why? Click the popup button to popup a new screen, and then click the print button on the popup (which doesn't do anything!). <html> <head> <title>UGH!</title> <script type="text/javascript">
1
1189
by: nntp | last post by:
It works in IE and Opera, but not in NS. Demo: http://javascript.internet.com/games/mouse-bomb.html Code: <!-- TWO STEPS TO INSTALL MOUSE BOMB: 1. Copy the coding into a new file, save as bomb.js 2. Add the last code into the BODY of your HTML document -->
3
5160
by: Bob Rivers | last post by:
Hi, I'm trying to build a web page where the user can insert text dinamically. When the user hits a button, a new text box is created and the user can insert text into it. It's working nice with Firefox 1.0, but it's not working with IE 6.0.2800.1106 (W2K SP4) function addText() {
7
1340
by: jammie_linux | last post by:
Hi, Please look at the following code. In my opinion, the value of "char *str" in the main function should not change even after calling the function "funct" and that's beacuse the "char *str" in the function funct is local to the function funct and therefore it's value will be meaningless when the function funct returns. But still the value of "char *str" in the main function is changing after calling the function funct. Can anybody help...
4
1153
by: Paul | last post by:
I added a textbox to a c# page and can access it with code behind but added a dropdown list by draging it on the page from the toolbar but when typing this. the dropdown id is not selectable and I can not access any of its attributes. -- Paul G Software engineer.
2
4483
by: graeme g | last post by:
ii i've been developing some usercontrols... and sudden the property designmode no longer works.. if i test it value at designtime it always comes back false... i've made a work around if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) b_designMode = true;
12
1991
by: Sheldon | last post by:
#define UWORD2 unsigned short int typedef BYTE Boolean; Boolean evaluateBit(UWORD2 *value, int bitnumber); Boolean evaluateBit(UWORD2 *value, int bitnumber) { int one=1; return (one &(*value >bitnumber)); } When I call the function like this:
1
1213
by: Phil Latio | last post by:
Can anyone tell me why:- class=\"$this->styleclass\" statement in the function generateHTML() (which is at very bottom) fails to pass the value "error" meaning I can't use the style class I defined? In the example below, I instantiate 3 objects and pass initial arguments to the constructor. Before displaying the form, I wish to pass a new argument to one of the objects. I tested it the syntax to ensure the assignment
2
1232
by: ft310 | last post by:
forwardpath gets loaded with "http://rhodeisland-aa.org/tester/ meetings/disclaima.htm?mtgnum=764" At "pos = forwardpath.indexof("disclaima.htm") ;" This stops with the error "forwardpath.indexof is not a function" I've been through a dozen variations of this code and could not get it to work. I originally started with "forwardpath.replace" but that was not
0
8692
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9181
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9040
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8924
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7756
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.