Lars Persson

Lars Persson

  • NA
  • 110
  • 0

Two simple? questions

Apr 1 2012 7:47 AM
First question:

I have a class in a separate file. Then I have a form with some controls.

How can I get access to the controlls in my class? Tried Form1.richTextBox1 but that doesn´t work.


Second question:

I  am creating object dynamicly.

In a form I use textBoxes to create values for the constructor.

Then in a button event I create an object and add it to a List, something like this.

car jaguar = new car(textBox1.Text, textBox2.Text);

carList.Add(car);

I know this works but how?

Everytime a new object is created it gets the same name. Does it work because you put it in the list and is it then impossible to find it in the list using the name of the object?







Answers (6)