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
> 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
> 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
Thanks
"Craig Stuntz [TeamB]" <craig_...@nospam.please [a.k.a. acm.org]> wrote
in message news:45f7...@newsgroups.borland.com...
> 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