Re: How to pass information, classes between forms in Windows Application mode



raylopez99 <raylopez99@xxxxxxxxx> wrote:

<snip>

OK, see below for an example, but keep in mind your console mode
example fails to be instructive for several reasons: (1) it's console
mode not Forms. Totally different, and if you don't see it that way no
use further discussing this issue.

In that case I guess it's the end of the discussion. Forms apps aren't
nearly as different as you seem to believe, and until you accept that I
suspect this conversation really won't go anywhere. In particular,
these things don't change at all when considering Forms apps:

1) There still has to be an entry point - a Main method
2) The Main method still has to be in a type, because all methods are
within types in C#.
3) Partial classes work the same with forms as with any other classes.
4) There's still no such thing as a forward declaration.
5) Pass-by-reference vs pass-by-value works exactly the same way
in WinForms apps as console apps (and any other C# code)
6) Class and variable declarations in C# work exactly the same way
in WinForms apps as console apps (and any other C# code)
7) Scoping and access rules in C# work exactly the same way
in WinForms apps as console apps (and any other C# code)

Are you seeing a pattern?

Forms apps are certainly more *complicated* than Console apps, because
there's all the designer code involved, and basically a lot more
*stuff*. But the language itself doesn't change.

Forms have certain 'entry points'
and certain quirks that must be obeyed. (2) you use the convention of
static void Main() being 'nested' inside a class, which does not show
how the nested class is seen by another class in a different
translation unit.

Please show who you could possibly have the Main method *not* in a
class or struct.

It goes to the heart of why form Form2:Form1 cannot
'see' Class0 unless Class0 is declared public *twice*, not just nested
with keyword public, but in the declaration public Class0 myClass0;
before the class Class0 is defined.

That's not declaring a class. That's declaring a variable called
myClass0, of *type* Class0. The sooner you understand that, the better.
Unless you use the "class" keyword, you're *not* declaring a class.

Perhaps, and I could use your input, the problem 'earlier' in this
thread is that classes 1 and 2, which are not nested, are not
explictly declared prior to the Form1 contructor with the keyword
'public', and, though in their respective modules I declare them as
'public', this makes them 'private' somehow when declared within Form
1 without the keyword 'public' (that is truly shocking if true).

Thanks for your help so far.  I look forward to your reply.

If you would post a short but *complete* program which demonstrates
something strange.

You did not even attempt to answer my question "Perhaps, and I could
use your input".

No, but I said what you needed to do for me to answer it: post a short
but complete program. When you do that, I'll answer your question.

Shows me you're still unaware of the complexity of
Forms, and the 'entry points' that I alluded to (which I would hazard
you don't even know exist).

Oh you really are priceless. Did you behave the same way with your
teachers at school? Yes, I'm very aware of entry points, thank you.

But, since a teacher learns from his
students almost as much as the students learn from the teacher, I will
give you a short example of this phenomena--and I encourage you to
replicate this problem in "Forms", not console mode.

Oh look, it's another incomplete example. See
http://pobox.com/~skeet/csharp/incomplete.html

(Hint: It's perfectly possible to post a complete WinForms program if
you really want to. You just haven't done so. It would be far simpler
to stick to console apps though.)

If you understand this simple example you're half way towards
understanding the problem in this thread.

I understand everything that occurs in the C# language in this thread.
I don't understand some of what you're trying to communicate because
you persist in talking inaccurate terms (such as "forward references")
and posting incomplete programs.

If you'd post a complete program which either you believe goes against
something I've said, or which contains some aspect you don't
understand, we may be able to make some progress.

--
Jon Skeet - <skeet@xxxxxxxxx>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
.



Relevant Pages

  • Re: Moving From ProTools to Linux? Good or bad?
    ... production apps. ... part of the tail end of the BeOS history was that TASCAM ... small/medium format digital recording console (or recording console ... my experience with open-source apps is that one has to be ...
    (rec.audio.pro)
  • Re: How to pass information, classes between forms in Windows Application mode
    ... different and you deal with console mode, ... myClass0, of *type* Class0. ... public partial class Form1: Form ... HIDES or 'overrides' previous declaration! ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Proposal: ConsoleVision
    ... >> Perhaps they are only writing these console apps in TP because they ... so they are gonna buy Delphi now, so they can keep writing the ... > Windows apps. ...
    (borland.public.delphi.non-technical)
  • Re: [PATCH] Stop printk printing non-printable chars
    ... I mixed up the ways for console output and for userspace ... apps using a shell over the very same serial line. ... "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: how to get rid of XFree in the longterm (just a thought)
    ... > only the streaming protocols and run all apps locally on smarter ... > console, and decide that you'd like to move what you are doing to a wall ... > of the job of network transparent distribution of gui apps. ... But one thing that isn't desirable is a monolithic API ...
    (comp.os.linux.x)