🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.csharpbuilder.language.csharp
5 messages
5 total messages Started by Godfrey Wed, 14 Mar 2007 09:47
Delphi to C#
#121
Author: Godfrey
Date: Wed, 14 Mar 2007 09:47
17 lines
1340 bytes
Hi

I am learning C#.  Are there any books/sites for persons with delphi 
experience moving to C#?.

I have one question which is bugging me perhaps someone can answer.

In Delphi, if you want to reference another form or its components you just 
added that form name to the uses section
in the form you are working (Delphi even added it automatically for you. Go 
Delphi).  Then you can work that form
or any of its components from another form.

How do I do this in C#?.  I tried making the component public but I cannot 
seem to get it right.

Thanks 
Re: Delphi to C#
#122
Author: Craig Stuntz TeamB
Date: Wed, 14 Mar 2007 14:27
25 lines
2010 bytes
Godfrey wrote:

> In Delphi, if you want to reference another form or its components
> you just added that form name to the uses section in the form you are
> working (Delphi even added it automatically for you. Go Delphi).
> Then you can work that form or any of its components from another
> form.
> 
> How do I do this in C#?.

	The C# equivalent of Delphi's "uses" is using. So you can say:

using Other_Namespace;

	If Other_Namespace contains an instance variable for the other form,
you can then work with that instance in your code.

	Remember that namespaces and files aren't the same thing. You specify
the namespace, not the filename.

-- 
Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better?  Use QC!
  http://qc.borland.com -- Vote for important issues
Re: Delphi to C#
#123
Author: Marc Rohloff TeamB
Date: Thu, 15 Mar 2007 01:37
23 lines
1990 bytes
On Wed, 14 Mar 2007 11:47:01 +0200, Godfrey wrote:

> In Delphi, if you want to reference another form or its components you just 
> added that form name to the uses section
> in the form you are working (Delphi even added it automatically for you. Go 
> Delphi).  Then you can work that form
> or any of its components from another form.
> 
> How do I do this in C#?.  I tried making the component public but I cannot 
> seem to get it right.

Delphi does a few things automatically for you (by default):
1) Components are public by default
2) It creates a public variable
3) At startup it creates an instance of every form and assigns it to
the variable.

You can do each of these yourself in c# (Edit the main() routine) but
they are all considered to contribute to bad program design.

-- 
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
Re: Delphi to C#
#124
Author: Godfrey
Date: Fri, 16 Mar 2007 07:26
31 lines
2051 bytes
Where do I insert this in my code?

Thanks

"Craig Stuntz [TeamB]" <craig_stuntz@nospam.please [a.k.a. acm.org]> wrote 
in message news:45f7f836@newsgroups.borland.com...
> Godfrey wrote:
>
>> In Delphi, if you want to reference another form or its components
>> you just added that form name to the uses section in the form you are
>> working (Delphi even added it automatically for you. Go Delphi).
>> Then you can work that form or any of its components from another
>> form.
>>
>> How do I do this in C#?.
>
> The C# equivalent of Delphi's "uses" is using. So you can say:
>
> using Other_Namespace;
>
> If Other_Namespace contains an instance variable for the other form,
> you can then work with that instance in your code.
>
> Remember that namespaces and files aren't the same thing. You specify
> the namespace, not the filename.
>
> -- 
> Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
>  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
> Want to help make Delphi and InterBase better?  Use QC!
>  http://qc.borland.com -- Vote for important issues 
Re: Delphi to C#
#125
Author: Craig Stuntz TeamB
Date: Fri, 16 Mar 2007 14:20
13 lines
1540 bytes
Godfrey wrote:

> Where do I insert this in my code?

	Using goes at the top of the file:

http://msdn2.microsoft.com/en-us/library/sf0df423.aspx

-- 
Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Useful articles about InterBase development:
  http://blogs.teamb.com/craigstuntz/category/21.aspx
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads