473,657 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Runtime code and VS DesignMode property

PW
I have a UserControl that executes a method in its constructor. The method
contains client/server code which populates a ComboBox in the UserControl. I
have a few problems with this:

1) The constructor code in question will throw an exception in the designer
because the server is not running. I can wrap the code with an exception
handler, but this could potentially have adverse effects during runtime.

2) The VS DesignMode property is not being set, and is otherwise useless
here.

Is there an alternative/workaround to hide the method from the designer?

Thanks.
Nov 17 '05 #1
0 1022

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

Similar topics

7
1763
by: Lucas Sain | last post by:
Hi, How can I make a code in an event not execute in design time. I have a Baseform that has X code in the event "VisibleChanged". All my forms inherit from this form. The code in this event always gets executed in design time, how do I avoid this?? Regards Lucas
29
5065
by: Charles Law | last post by:
Further to my issue about user controls, I have a problem with DesignMode. Here is the project hierarchy: MainApp |_ Project1 |_ SubProject (UserControl) SubProject has a default constructor (New) which does the MyBase.New() thing and then InitializeComponent().
4
1221
by: elziko | last post by:
How do I make a property of a class Readonly but only at RUNTIME? I want to be able to edit the value in a property browser after dragging my component on a form but then not allow any code to change this property when the code is running. TIA
7
8816
by: Fabio Cannizzo | last post by:
How can I prevent a few lines of code contained in the constructor of a Form from being executed by the Designer? Thanks, Fabio
4
1470
by: Kyjan | last post by:
Greetings! In doing some research, I've learned that some other people have had problems with Me.DesignMode not working correctly when it's used in a user control that is placed on another form. There was a suggestion... Protected Shadows ReadOnly Property DesignMode() As Boolean Get If (MyBase.DesignMode) Then Return True
4
1816
by: Janiek Buysrogge | last post by:
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.
2
1702
by: TerryStone | last post by:
I have created a control that displays a list of items. During design mode I fill it with junk data using calls from the constructor. So when I look at a form with the control on, instead of being empty, it has some content, and this gives a better idea of what the form will look like when run. During runtime it should be empty to start with, so I comment out the code in the constructor that fills it with dummy data. How can I code...
2
1494
by: Martin Arvidsson | last post by:
Hi! I have developed a component that creates a lookup for selecting values. At designtime i want to display the windows as well but with certain criterias. is there a property or something to look at that tells mee if its designtime or runtime? Regards Martin
2
1701
by: Johnny Jörgensen | last post by:
I would like to be able to tell whether my component code is executed when I instanciate a control in runtime or in designtime. Can anybody give me a clua as to how you can do that? Cheers, Johnny J.
0
8397
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
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
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...
1
8503
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
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
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.