
Originally Posted by
CarlMartin
The class I created was striking similar to yours, but I tried to substitute the "text" you have here with variable names, and the names of the textboxes, and I got errors. I don't know how to get the data entered into a textbox into the class. thanks.
BigEd went over this briefly.
The class has a constructor that sets its properties to the parameter values of the constructor. The class also has public properties, so you don't have to use the constructor/
So, you could do:
Code:
Contact contact = new Contact();
contact.FirstName = textBoxFirstName.Text;
// and so on...
Or,
Code:
Contact contact = new Contact(textBoxFirstName.Text, textBoxLastName.Text, ...);