Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing control in form1.cs from program.cs 1

Status
Not open for further replies.

Bujitsu

MIS
Oct 23, 2003
67
AU
Hi,

I have put my code in program.cs, and as a result I am unable access the text box in form1.cs.

How do get around this?

Cheers
 
What code do you have in there? It is usual to just put the start up form in there... as it is a static class.

Age is a consequence of experience
 
Since forms are objects, you'll need a variable which points to your instance of Form1.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
It was some network code, that I was trying to learn. But I have since read that I shouldn't put anything in the "program.cs" file. In that case should I use a "codefile.cs" to put all code in that is not related to an event? Or create a class and have it as functions? I am not sure about how to proceed as having done "C" at University I was used to seperating everything in to files.

Cheers
 
you should have a form that shows results from a class. but just to get you going just make a form and do all your stuff behind (to get behind - drop a button on form and double click), to make a form, right click on you Solution explorer then from the menu go to add - > new Item, chose Form from the list and give it a name. click ok and your done:)

Age is a consequence of experience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top