コード例 #1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ListView1.Items.Count == 0)
     {
         MessageBox.Show("Please select record to update", "Update", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     try
     {
         if (ListView1.FocusedItem != null)
         {
             if (string.IsNullOrEmpty(ListView1.FocusedItem.Text))
             {
             }
             else
             {
                 SQLConn.adding   = false;
                 SQLConn.updating = true;
                 catgoryID        = Convert.ToInt32(ListView1.FocusedItem.Text);
                 frmAddEditCategory aeC = new frmAddEditCategory(catgoryID);
                 aeC.ShowDialog();
             }
         }
     }
     catch
     {
         MessageBox.Show("Please select record to update", "Update", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
 }
コード例 #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            SQLConn.adding   = true;
            SQLConn.updating = false;
            int init = 0;
            frmAddEditCategory aeC = new frmAddEditCategory(init);

            aeC.ShowDialog();
        }