8
Reply

Begginers question - accessing properties of another class

Nick

Nick

Apr 3 2007 8:23 AM
2.8k
Hi, I am using visual studio to create a C# application. I have designed a form with buttons, etc. The code that visual studio generates is similar to the following: [code] namespace WindowsApplication1 { partial class Form1 { //lots of stuff here private System.Windows.Forms.Button btnStart; private System.Windows.Forms.TextBox tbURL; } } [/code] In the main application, I have the following [code] namespace WindowsApplication1 { public partial class Form1 : Form { //Here I can access the components directly, etc. tbTextBox.Text = whatever } } class someclass { //Here i cannot access any of the form components } [/code] I want to access the components from "someclass". I have tried making the components public in the code that visual studio generates, I have tried using: WindowsApplication1.Form1.whatever... nothing works. Any ideas?

Answers (8)