473,602 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DesignMode broken - suggested path?

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.DesignM ode) Then
Return True
Else
Dim parent As Control = Me.Parent
While Not (parent) Is Nothing
Dim site As ISite = parent.Site
If Not (site) Is Nothing AndAlso
site.DesignMode Then
Return True
End If
parent = parent.Parent
End While
Return False
End If
End Get
End Property

....but this suggestion does not work effectively. Does anyone know of
another way and/or a supplement to this recursive function that I am
not seeing? I've heard that you can use GetCurrentProce ss, but that
didn't seem to work for me.

Thanks,

Kyjan

Jun 29 '06 #1
4 1466
Kyjan,

I don't know if others understand this text but I don't.

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...

A user control can be placed on every form, therefore I have the idea that
you mean something else?

Cor
Jun 29 '06 #2
My apologies, I should have elaborated a little more.

I have created a user control that has some code that needs to run in
the Load event. When I compile the user control and then place the
user control on another form, because of the fact that the designer
actually instantiates the class, it runs the code in the Load event.
I'm trying to prevent that by testing the DesignMode property.
However, it's not working correctly because even though the UC might
not be in design mode, the form that the UC is on is in DesignMode.

Kyjan

Cor Ligthert [MVP] wrote:
Kyjan,

I don't know if others understand this text but I don't.

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...

A user control can be placed on every form, therefore I have the idea that
you mean something else?

Cor


Jun 29 '06 #3
Does anyone have any suggestions?

Kyjan

Jun 30 '06 #4
I would put your code into a public subroutine of the control and call it
from the load event of the form instead of the load event of the control -
assuming that will accomplish what you want. As you've found, you can't
rely on control events to happen when you think they should. In VS03 I've
had a lot of problems with user controls firing events at odd times and
repeatedly. It's a little more work, but it works for me.

hth;

DCraig.
"Kyjan" <Ho***********@ gmail.com> wrote in message
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Does anyone have any suggestions?

Kyjan

Jun 30 '06 #5

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

Similar topics

1
2316
by: Thomas | last post by:
Hy dudes, I have a strange problem. I dynamically create an IFrame with JavaScript and then fill in some content. Afterwards I want to switch to designMode. There the trouble starts. In Mozilla it works perfectly (even it doesn't stop loading the page, but this doesn't matter), but the whole IE crashes and shuts down itself without reason. Can you help? Has someone had the same problem? I already switched the order for filling the...
2
7488
by: Lecture Snoddddgrass | last post by:
Hi, When I create a UserControl-derived object, I often expose various public properties. One of the things that I hate about the WinForms designer is that if I decide to embed one of these controls in a form (or another control), the designer likes to "touch" each of my custom properties -- either by trying to "set" it to a default value (null/zero) or trying to "get" it's value. This is a real PITA because often times calling "get" on...
1
4926
by: Tiago Barbutti | last post by:
I have a UserControl that execute methods in Load event, but it hapens in designMode and generate an error and the control disappear from the form. I read that i can use the DesignMode to kwnow when my control is in design or Runtime mode, it´s work, but when this usercontrol is put in another usercontrol the DesignMode property always return false. How can I do to stop the methods to execute in designMode when my usercontrol is in...
2
5948
by: Malleier Alfred | last post by:
Hi, what does the Me.DesignMode-Property turn back. I tried to set a MsgBox(Me.DesignMode) in my form's and control's Sub New(), but it allways turns back 'false', even if the form or control is open in Designmode. To set correctly the properties when changed in the property-browser while designing I need to know if the control is in designtime or in runtime-mode. Is there a way to manage this?
29
5060
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().
1
2201
by: Paul W | last post by:
I'm having trouble detecting whether my Control is in DesignMode. I'm deriving a class from TreeView; Public Class ExplorerView Inherits TreeView ... End Class
2
2277
by: Simon Rigby | last post by:
Hi folks, I'm trying to switch an iFrame in and out of design mode by way of a script. As you can see from the method it is intended to be cross browser compatible (or FF and IE at least). The FF version (the else branch) works fine but the if branch (IE) switches into design Mode but wont switch back. Below is my method, the iFrame tages and the anchor used to trigger the function call. Any help greatly appreciated.
2
4477
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;
3
4130
by: Giampaolo Rodola' | last post by:
Hi there, I would like to know if such function would be correct for verifying if a link is broken and/or circular. def isvalidlink(path): assert os.path.islink(path) try: os.stat(path) except os.error: return 1
0
8404
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
8054
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
8268
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...
1
5867
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
3900
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...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
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
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
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.