PC Review


Reply
Thread Tools Rate Thread

Constructors with arguments

 
 
SamSpade
Guest
Posts: n/a
 
      1st Mar 2004
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


 
Reply With Quote
 
 
 
 
Mythran
Guest
Posts: n/a
 
      1st Mar 2004

" SamSpade" <(E-Mail Removed)> wrote in message
news:%23OsrMG9$(E-Mail Removed)...
> 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


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      1st Mar 2004
* " SamSpade" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
SamSpade
Guest
Posts: n/a
 
      2nd Mar 2004
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]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:c20a7l$1nj7cm$(E-Mail Removed)...
> * " SamSpade" <(E-Mail Removed)> 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/>



 
Reply With Quote
 
SamSpade
Guest
Posts: n/a
 
      2nd Mar 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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]" <hirf-spam-me-(E-Mail Removed)> wrote in message
> news:c20a7l$1nj7cm$(E-Mail Removed)...
> > * " SamSpade" <(E-Mail Removed)> 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/>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control constructors taking arguments? Kristian Frost Microsoft VB .NET 3 5th Sep 2006 05:05 PM
Constructors? Arpan Microsoft ASP .NET 1 5th Sep 2006 07:33 AM
Classes derived from ServicedComponent do not support constructors with arguments? zlf Microsoft C# .NET 3 2nd Jun 2006 03:25 PM
Constructors in C# =?Utf-8?B?R3JlZyBIb3J3b29k?= Microsoft C# .NET 6 4th Jan 2005 05:50 AM
Constructors Ravikanth[MVP] Microsoft C# .NET 0 4th Aug 2003 10:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:50 PM.