Пример #1
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     gr = new List <Grau>();
     foreach (ListViewItem item in listView1.Items)
     {
         Grau g = new Grau
         {
             Grau_obtencao = item.Text,
             Local         = item.SubItems[1].Text,
             Dt_obtencao   = item.SubItems[2].Text
         };
         gr.Add(g);
     }
     MessageBox.Show("Notas registradas.");
 }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Grau gr = new Grau();

            gr.Grau_obtencao = txtGrau.Text;
            gr.Local         = txtLocal.Text;
            gr.Dt_obtencao   = dtpData.Value.ToShortDateString();

            if (string.IsNullOrEmpty(txtGrau.Text) || string.IsNullOrEmpty(txtLocal.Text))
            {
                MessageBox.Show("Falta requisito.");
            }

            ListViewItem newList = new ListViewItem(gr.Grau_obtencao);

            newList.SubItems.Add(gr.Local);
            newList.SubItems.Add(gr.Dt_obtencao);
            listView1.Items.Add(newList);
        }