I have a UserControl that must have 2 fields initialized before some of the
prorperties are used. So I added a new New sub with arguments.
If I leave the old New in there the control could be used without initializing
these fields so I removed it.
Now if I try to use it the designer gets upset because there is no New()
Is it posible to use only a New with arguments and still use the control in the
Designer??
Thanks in advance 6 997
This is where using Me.DesignMode is useful, or validating your properites
before you actually use them. The Designer (VSIDE) only calls the 0
argument constructor (unless there is some really fancy attribute I don't
know if). However, like I said, you can just validate your variables, and
when a property is set, call a method to do whatever it is your user control
needs to initialize from the same constructor.
-CJ
"TryingLikeHeck " <tr************ @aol.com> wrote in message
news:20******** *************** ****@mb-m07.aol.com... I have a UserControl that must have 2 fields initialized before some of
the prorperties are used. So I added a new New sub with arguments.
If I leave the old New in there the control could be used without
initializing these fields so I removed it.
Now if I try to use it the designer gets upset because there is no New()
Is it posible to use only a New with arguments and still use the control
in the Designer??
Thanks in advance
Lots of code I was hoping to avoid, but I want to use the Designer so I have
to work with its limitations.
Thanks for the info. At least I now know not to keep trying
"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:vt******** ****@corp.super news.com... This is where using Me.DesignMode is useful, or validating your properites before you actually use them. The Designer (VSIDE) only calls the 0 argument constructor (unless there is some really fancy attribute I don't know if). However, like I said, you can just validate your variables, and when a property is set, call a method to do whatever it is your user
control needs to initialize from the same constructor.
-CJ
"TryingLikeHeck " <tr************ @aol.com> wrote in message news:20******** *************** ****@mb-m07.aol.com... I have a UserControl that must have 2 fields initialized before some of the prorperties are used. So I added a new New sub with arguments.
If I leave the old New in there the control could be used without initializing these fields so I removed it.
Now if I try to use it the designer gets upset because there is no New()
Is it posible to use only a New with arguments and still use the control in the Designer??
Thanks in advance
It's really not that bad. Just do some fun tricks with it. like if you run
validation routines inside your properties at all, you can just reset them
to themselves and it will re run it with the same values. i.e.
me.propertyname = me.propertyname
Kinda fun way to do it. =)
-CJ
" active" <ac****@REMOV Ea-znet.com> wrote in message
news:uE******** ********@TK2MSF TNGP11.phx.gbl. .. Lots of code I was hoping to avoid, but I want to use the Designer so I
have to work with its limitations.
Thanks for the info. At least I now know not to keep trying "CJ Taylor" <no****@blowgoa ts.com> wrote in message news:vt******** ****@corp.super news.com... This is where using Me.DesignMode is useful, or validating your
properites before you actually use them. The Designer (VSIDE) only calls the 0 argument constructor (unless there is some really fancy attribute I
don't know if). However, like I said, you can just validate your variables,
and when a property is set, call a method to do whatever it is your user control needs to initialize from the same constructor.
-CJ
"TryingLikeHeck " <tr************ @aol.com> wrote in message news:20******** *************** ****@mb-m07.aol.com... I have a UserControl that must have 2 fields initialized before some
of the prorperties are used. So I added a new New sub with arguments.
If I leave the old New in there the control could be used without initializing these fields so I removed it.
Now if I try to use it the designer gets upset because there is no
New() Is it posible to use only a New with arguments and still use the
control in the Designer??
Thanks in advance
" active" <ac****@REMOV Ea-znet.com> wrote in message
news:uE******** ********@TK2MSF TNGP11.phx.gbl. .. Lots of code I was hoping to avoid, but I want to use the Designer so I have to work with its limitations.
OK, I'm new to this, but...
Could use add the niladic constructor (assigning "sensible" default
values for use in the Designer) but throw an Exception if its called
from outside the Designer?
Just a thought...
Phill W.
On 11 Dec 2003 13:39:21 GMT, TryingLikeHeck wrote: I have a UserControl that must have 2 fields initialized before some of the prorperties are used. So I added a new New sub with arguments.
If I leave the old New in there the control could be used without initializing these fields so I removed it.
Now if I try to use it the designer gets upset because there is no New()
Is it posible to use only a New with arguments and still use the control in the Designer??
Thanks in advance
Could you do something like this? As long as you work in debug mode, the
designer can use the parameterless constructor. When you're ready to
compile to release mode, then the code is not included?
#If Debug
Public Sub New()
'Code
End Sub
#Endif
Public Sub New(parameters)
MyBase.New
InitializeCompo nents
End Sub
Just an idea
--
Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
* " active" <ac****@REMOV Ea-znet.com> scripsit: Lots of code I was hoping to avoid, but I want to use the Designer so I have to work with its limitations.
I wouldn't consider this to be a "limitation ". It's a good
compromiss...
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steven T. Hatton |
last post by:
This is something I've been looking at because it is central to a currently
broken part of the KDevelop new application wizard. I'm not complaining
about it being broken, It's a CVS images. Such things happen. The whole
subsystem is going through radical changes. I don't really want to say
what I think of the code just yet. That would...
|
by: Rajat Tandon |
last post by:
Hello there,
I am relatively new to the newsgroups and C#. I have never been disappointed
with the groups and always got the prompt replies to my queries.This is yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.
So here we go ...
I am not able to take the screen shot of the windows form...
|
by: stubbsie |
last post by:
Hi,
I have redesigned our official public government website in .net and it has
taken me a few months to redo. I have been the sole designer of the website
from its humble beginnning a few years ago when no one wanted to even mess
with it. Since then I have been steadily maintaining it and improving it. I
am about halfway done, and all of a...
|
by: Chris F Clark |
last post by:
Please excuse the length of this post, I am unfortunately long-winded,
and don't know how to make my postings more brief.
I have a C++ class library (and application generator, called
Yacc++(r) and the Language Objects Library) that I have converted over
to C#. It works okay. However, in the C# version, one has to build
the class library...
|
by: rizwanahmed24 |
last post by:
Hello
i have made a custom control. i have placed a panel on it. I want this
panel to behave just like the normal panel. The problem i was having is
that the panel on my custom control doesnt accept other controls. The
control i drag drop on it becomes the child of my custom control's
parent form and not the child of my custom control. Then...
| |
by: cj |
last post by:
In a project done in 2003 about a year ago I was told to add the
SocketWrench code below into the Windows Form Designer generated code
area as shown below.
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
|
by: TomC |
last post by:
I want to bypass the Windows Form Designer in VS, to create a form
programmatically. The elements of the form are to be arranged in a
table, and I want the size of the table (and therefore the number of
elements) to be determined at runtime, so dragging and dropping on the
Form Designer won't cut the mustard.
I'm coming from a Java...
|
by: Goran Djuranovic |
last post by:
Hi all,
I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page.
- Why is this happening?
- Can I disable automatic declaration and have everything be declared manually?
- Any other options to fix this?
Thanks in...
|
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= |
last post by:
Yesterday Visual Studio gave me a strange error both at compiletime and at
designtime that had no obvious connection to anything I had changed recently.
After some effort tracking down the problem I discovered first a workaround,
then the real cause of the problem. I would like to understand why what I am
doing is frowned upon by Visual Studio...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |