where to put main in windows app

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

I have an app that consists only of a windows form. I used
the designer to create the form, then added some code.
But... I don't understand where to put the code. Where do
I put main so that the form can access the variables from
main? If I want to declare a new class type, where do I
put that? Right now, all of my code is within "Public
Class Form45"

Thanks
 
If you declare your variable within namespace.class then your variable
will be seen by your form. And if you read your code (created by the
designer), you'll understand that creating new form is instantiate and
object.

You can start by reading various OOP books.

Regards,

Riwut
 
create a new project of type "Windows application". VS will create a form
and will add the main code to it. If you start with a project of another
type (like class library) and add the form, you won't get the main routine.

That's probably the easiest way.

--- Nick
 
Back
Top