private void btnOK_Click(object sender, EventArgs e) { theCar = new Car() { PetName = txtCarName.Text, Make = lstMakes.Text, Color = lstColors.Text }; }
private void okButton_Click(object sender, EventArgs e) { if (tbColor.Text.Length > 0 && tbmake.Text.Length > 0 && tbPetname.Text.Length > 0) { theCar = new Car { Color = tbColor.Text, Make = tbmake.Text, PetName = tbPetname.Text }; this.DialogResult = DialogResult.OK; } }