コード例 #1
0
        private void button1_Click_1(object sender, EventArgs e)    //insert a new item
        {
            InfoView newObj = new InfoView();

            // register insert Event
            newObj.Event += new CSProDemo.View.ListItemEvent(insertListItem);
            newObj.ShowDialog();
            if (newObj.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
            }
            else if (newObj.DialogResult == System.Windows.Forms.DialogResult.Cancel)
            {
            }
            if (selected != null && selected.Count > 0)
            {
                selected.Clear();
            }
            // this.Close();
        }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)  //updata event
 {
     if (selected != null && selected.Count != 0)
     {
         InfoView oldObj = new InfoView();
         // register insert Event
         oldObj.Event += new CSProDemo.View.ListItemEvent(updateListItem);
         oldObj.LoadEvent(loadItem());
         oldObj.ShowDialog();
         if (oldObj.DialogResult == System.Windows.Forms.DialogResult.OK)
         {
         }
         else if (oldObj.DialogResult == System.Windows.Forms.DialogResult.Cancel)
         {
         }
         selected.Clear();
     }
     else
     {
         DialogResult result = MessageBox.Show("please select only one item", "Form update", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }