Constructors with arguments

  • Thread starter Thread starter SamSpade
  • Start date Start date
S

SamSpade

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
 
SamSpade said:
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
 
* " SamSpade said:
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.
 
I thought that's what I did last time. Sometimes just knowing it should work
helps. I'll try again.

Thanks
 
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 said:
I thought that's what I did last time. Sometimes just knowing it should work
helps. I'll try again.

Thanks
 
Back
Top