Yo PD,
Thanks for the reply!
I get what you are saying, but I respectfully disagree.
If anything, to me coding using windows forms and buttons really
breaks up your code and makes you have to deal with scope, which is
fundamental to everything else.
Also, it never addresses the real issue of scope that I was having.
Slapping me upside the head and saying, your reference to an object is
still a VARIABLE, so quit treating it like an object would have taught
me more than saying I shouldn't being programming in Windows Forms
yet.
But again, I do thank you for taking the time to reply at all and I
welcome your help in the future!



On Nov 13, 3:14 am, Processor Devil <[email protected]> wrote:
> If you are just learning OOP, you should code Console Application at
> first...
> It is because you need to get the feel for objects (classes, interfaces,
> etc) and some graphics should not bother you now.
> All you need for console application is System.Console.ReadLine() and
> System.Console.WriteLine() and the other part will always be your code.
>
> 2009/11/12 Greg <[email protected]>
>
>
>
> > I am actually embarassed that I have to ask this question.
> > I am just learning C# and OOP and I have created a sample Windows Form
> > program and added a class file to it.
>
> > The class files relevant code is. . .
>
> > namespace RaceTrack
> > {
> >    class Customer
> >    {
> >        public string Name;
> >        public int Cash;
> >    }
> > }
>
> > So now in my Form1.cs file in the Form Load event I have
>
> > Customer Greg = new Customer() { Cash = 100 };
>
> > Now under the Form Load event where I created the reference to  the
> > object I can refer to it all day long!
>
> > Now I place a button on the form, but when I add code like
>
> >    label1.Text = Greg.Cash;
>
> > I get  'Greg' does not exist in the current context
>
> > namespace RaceTrack
> > {
> >    class Customer
> >    {
> >        public string Name;
> >        public int Cash;
> >    }
> > }
> > I added
> >    using RaceTrack;
> > and that didn't help.
>
> > What am I doing wrong? When I try to look up scope for objects I read
> > that there is not really a scope for an object, it exists, until it is
> > garbage collected.
>
> > I am feeling super stupid about this. Can anyone help? I'll even take
> > the ridicule with a smile if you can help me out.- Hide quoted text -
>
> - Show quoted text -

Reply via email to