private void getSentences(ref MorseCode phrase) { try { phrase.sentence = txtPhrase.Text; }//end try catch (Exception ex) { MessageBox.Show(ex.Message); } //end catch } //end of void method
private void btnAdd_Click(object sender, EventArgs e) { //create instance MorseCode s = new MorseCode(); //call method to get data from screen getSentences(ref s); //add to list object MorseCodeList.Add(s); txtPhrase.Clear(); }