473,394 Members | 1,481 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,394 software developers and data experts.

Constructors with arguments

A while ago I tried to use arguments in usercontrol constructors but the
designer didn't like it so I worked around not using them.

However the code would be much cleaner if I could use arguments.

Is there some way that people use both the designer and arguments?

I suppose I could comment out some code when I open the designer and put it
back after I close it but that's not very neat.

Any suggestions?

Also I usually use Integer but I see a lot of code using Int32. Make any
difference? If it's just style is the Int32 more commonly used?
Thanks
Nov 20 '05 #1
4 950

" SamSpade" <st**************@REMOVEaol.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
A while ago I tried to use arguments in usercontrol constructors but the
designer didn't like it so I worked around not using them.

However the code would be much cleaner if I could use arguments.

Is there some way that people use both the designer and arguments?

I suppose I could comment out some code when I open the designer and put it
back after I close it but that's not very neat.

Any suggestions?

Also I usually use Integer but I see a lot of code using Int32. Make any
difference? If it's just style is the Int32 more commonly used?


Look up Control Designers. :)

Mythran
Nov 20 '05 #2
* " SamSpade" <st**************@REMOVEaol.com> scripsit:
A while ago I tried to use arguments in usercontrol constructors but the
designer didn't like it so I worked around not using them.

However the code would be much cleaner if I could use arguments.

Is there some way that people use both the designer and arguments?


You can define parameterless and parameterized ctors, the designer will
use the parameterless ctor.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #3
I thought that's what I did last time. Sometimes just knowing it should work
helps. I'll try again.

Thanks

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c2*************@ID-208219.news.uni-berlin.de...
* " SamSpade" <st**************@REMOVEaol.com> scripsit:
A while ago I tried to use arguments in usercontrol constructors but the
designer didn't like it so I worked around not using them.

However the code would be much cleaner if I could use arguments.

Is there some way that people use both the designer and arguments?


You can define parameterless and parameterized ctors, the designer will
use the parameterless ctor.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>

Nov 20 '05 #4
I didn't try yet but I wonder if I could do something to force users to us
the parameterized constructor? Like check in the parameterless one to see if
it's in "Design" mode?

Word definitions: Is it true that parameters are used when a method is
defined and arguments are supplied in the call?

Also is Int32 used more commonly than Integer? Or do they each have a
purpose?

Thanks

" SamSpade" <st**************@REMOVEaol.com> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
I thought that's what I did last time. Sometimes just knowing it should work helps. I'll try again.

Thanks

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c2*************@ID-208219.news.uni-berlin.de...
* " SamSpade" <st**************@REMOVEaol.com> scripsit:
A while ago I tried to use arguments in usercontrol constructors but the designer didn't like it so I worked around not using them.

However the code would be much cleaner if I could use arguments.

Is there some way that people use both the designer and arguments?


You can define parameterless and parameterized ctors, the designer will
use the parameterless ctor.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>


Nov 20 '05 #5

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

Similar topics

42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
4
by: Ganesh Gella | last post by:
Hi All, While going through xalan's XSLT source code, I came across few constructors which are qualified as "explicit". These constructors are empty constructors. I read about the use of...
10
by: John | last post by:
Trying to find out what is essential / optional, I made an extremely simple Class and Module combination to add two numbers. (see below) It appears that an empty constructor is needed n order to...
3
by: John | last post by:
Before anything else, thanks Marina, Workgroups and Ralf, for your help so far. I am now able to better define the question! After adding more console printout lines to CSum, I tried all...
20
by: lars.uffmann | last post by:
I have to work on a rather big project that a bunch of people wrote and that has no useful documentation at all, my C++ has rusted in a bit, now I stumbled over a constructor that looks something...
12
by: Oleg Subachev | last post by:
I am moving from Delphi to C# and hve encountered the problem: I have the following classes and form Load event handler: public class class1 { public string S; public class1( string aS ) {...
3
by: zlf | last post by:
I am asked to complete a COM+ component, there is a class A derived from ServicedComponent. However, when executing , exception is thrown. Messaged: Unhandled Exception:...
7
by: andrewfsears | last post by:
I have a question: I was wondering if it is possible to simulate the multiple constructors, like in Java (yes, I know that the languages are completely different)? Let's say that I have a class...
2
by: Christof Warlich | last post by:
Hi, I'd like to define a class that should behave as much as posible like std::string, but that has some small additional property: class ExtendedString: public std::string { public: void...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...
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
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...

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.