Board index » delphi » Re: How do I do .... in C#?
David Clegg
![]() Delphi Developer |
David Clegg
![]() Delphi Developer |
Re: How do I do .... in C#?2005-01-27 08:27:19 AM delphi275 Nick Hodges [TeamB] writes: QuoteDon't listen to Rudy. We still have it. it is been cleaned though. go unpunished. I will leave the matter in your capable hands. -- Cheers, David Clegg XXXX@XXXXX.COM |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 08:30:29 AM
Re: How do I do .... in C#?
Nick Hodges [TeamB] writes:
QuoteDavid Clegg writes: -- Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "God, please save me from your followers!" - Bumper Sticker |
Nick Hodges [TeamB]
![]() Delphi Developer |
2005-01-27 08:31:38 AM
Re: How do I do .... in C#?
Rudy Velthuis [TeamB] writes:
QuoteDo you really think a comfy chair scares me? Pah! Usually I scare Nick Hodges -- TeamB Lemanix Corporation -- www.lemanix.com Read my Blog -- www.lemanix.com/nick |
Tim Jarvis
![]() Delphi Developer |
2005-01-27 08:34:56 AM
Re: How do I do .... in C#?
Ingvar Nilsen writes:
Quote>One cool syntax in C# is the syntax you can use to chain commenting on the elegant syntax for doing that. I do of course realise that, that is subjective, do you like it ? (the syntax that is) |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 08:37:47 AM
Re: How do I do .... in C#?
Nick Hodges [TeamB] writes:
QuoteRudy Velthuis [TeamB] writes: Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- Henry Louis Mencken (1880-1956) |
Nick Hodges [TeamB]
![]() Delphi Developer |
2005-01-27 08:38:48 AM
Re: How do I do .... in C#?
Rudy Velthuis [TeamB] writes:
QuoteCan I bring some tools? <g> Nick Hodges -- TeamB Lemanix Corporation -- www.lemanix.com Read my Blog -- www.lemanix.com/nick |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 08:40:23 AM
Re: How do I do .... in C#?
Tim Jarvis writes:
QuoteIngvar Nilsen writes: constructor of this class. Why not simply code them there? I guess this was done for C++ users. <g> -- Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "Believe those who are seeking the truth. Doubt those who find it." -- Andr?Gide |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 08:42:34 AM
Re: How do I do .... in C#?
Nick Hodges [TeamB] writes:
QuoteRudy Velthuis [TeamB] writes: Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "Everybody wants to go to heaven, but nobody wants to die." -- Joe Louis. |
Tim Jarvis
![]() Delphi Developer |
2005-01-27 08:46:43 AM
Re: How do I do .... in C#?
Rudy Velthuis [TeamB] writes:
QuoteI think it detracts from what really happens. In the first, the InitializeComponent, if you remove the paramentless one you will break the designer but if you just add another constructor now you will need to make the same call to InitializeComponent. i.e. public TheForm() { InitializeComponent; } public TheForm(SomeClass myObject) : this() { BindTheObjectToTheForm(); } See where I am coming from ? |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 08:53:11 AM
Re: How do I do .... in C#?
Tim Jarvis writes:
QuoteSee where I am coming from ? Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "It is time I stepped aside for a less experienced and less able man." - Professor Scott Elledge on his retirement from Cornell |
Tim Jarvis
![]() Delphi Developer |
2005-01-27 08:57:40 AM
Re: How do I do .... in C#?
Rudy Velthuis [TeamB] writes:
QuoteTim Jarvis writes: |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 09:02:11 AM
Re: How do I do .... in C#?
Tim Jarvis writes:
QuoteRudy Velthuis [TeamB] writes: -- Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy next to me." -- Woody Allen. |
Tim Jarvis
![]() Delphi Developer |
2005-01-27 09:12:26 AM
Re: How do I do .... in C#?
Rudy Velthuis [TeamB] writes:
Quote
one of your classes, and what you also want to do is pass you object that you want to edit in the constructor to bind it to the form i.e. MyClassDialog dlg = new MyClassDialog(myClassInstance); When you have created your dialog the .NET designer has created a parameterless constructor for you with a call to InitializeComponent i.e. public MyClassDialog() { InitializeComponent(); } now, we can not remove this one and place the Init call into our constructor because this would break the desiger, our options are then to either duplicate the call to the initialization routine or to chain it i.e. public MyClassDialog(MyClass myClassInstance) { InitializeComponent(); BindMyClassToTheDialog(); } or Public MyClassDialog(MyClass myClassInstance) : this() { BindMyClassToTheDialog(); } I personally prefer the chaining approach, appeals to my sense of reuse. Regards Tim. |
Rudy Velthuis [TeamB]
![]() Delphi Developer |
2005-01-27 09:19:13 AM
Re: How do I do .... in C#?
Tim Jarvis writes:
QuotePublic MyClassDialog(MyClass myClassInstance) : this() public MyClassDialog(MyClass myClassInstance) { this(); // pseudo-C#, i.e. how Delphi does it. BindMyClassToTheDialog(); } constructor MyClassDialog.Create(myClassInstance: MyClass); begin Create; BindMyClassToTheDialog(myClassInstance); end; I think the Delphi syntax is clearer. -- Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de "I've had a wonderful time, but this wasn't it." -- Groucho Marx (1895-1977) |
John Kaster (Borland)
![]() Delphi Developer |
2005-01-27 09:19:46 AM
Re: How do I do .... in C#?
Ingvar Nilsen writes:
QuoteYeah, very easy.. if you know what to search for. -- John Kaster blogs.borland.com/johnk Features and bugs: qc.borland.com Get source: cc.borland.com What's going on? calendar.borland.com |