コード例 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.CurrentRow == null)
                {
                    throw new Exception("请在【文件列表】中,选中需要删除的文件");
                }

                if (MessageDialog.ShowEnquiryMessage("您是否要删除【文件编号】:"
                                                     + txtFileNo.Text + " 【文件名称】:" + txtFileName.Text + "?") == DialogResult.No)
                {
                    return;
                }

                m_serverBasicInfo.DeleteFile(Convert.ToInt32(dataGridView1.CurrentRow.Cells["文件ID"].Value));
                treeView1_AfterSelect(null, null);
                throw new Exception("删除成功");
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }