List <CellphoneData> PhoneList = new List <CellphoneData>();          // List to hold PhoneList objects

        private void createObjectButton_Click(object sender, EventArgs e)
        {
            CellphoneData myPhone = new CellphoneData();        // Create a myPhone object.

            GetPhoneData(myPhone);                              // Get the phone data.
            OutPutPhoneData(myPhone);
            OutPutPhoneData2(myPhone);
        }
        private void OutPutPhoneData2(CellphoneData myPhone)
        {
            PhoneList.Add(myPhone);                                 // Add the myPhone object to the List.
            phoneListBox.Items.Add(myPhone.Brand + " " +            // Add an entry to the list box.
                                   myPhone.Model + " is " + myPhone.Price.ToString("$" + "0.00"));

            brandTextBox.Clear();                                   // Clear the TextBox controls.
            modelTextBox.Clear();
            priceTextBox.Clear();
            brandTextBox.Focus();
        }
        private void GetPhoneData(CellphoneData myPhone)
        {
            decimal price;                                      // Temporary variable to hold the price.

            myPhone.Brand = brandTextBox.Text;                  // Get the phone's brand.
            myPhone.Model = modelTextBox.Text;                  // Get the phone's model.
            if (decimal.TryParse(priceTextBox.Text, out price)) // Check exception and Get the phone's price.
            {
                myPhone.Price = price;                          // Assign the price to the property
            }
            else
            {
                MessageBox.Show("Invalid price");               // Display an error message.
            }
        }
 private void OutPutPhoneData(CellphoneData myPhone)
 {
     brandLabel.Text = myPhone.Brand;                    // Display the phone data.
     modelLabel.Text = myPhone.Model;
     priceLabel.Text = myPhone.Price.ToString("c");
 }