コード例 #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Edit_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridViewSelectedRowCollection rows = dataGridView1.SelectedRows;
                if (rows == null || rows.Count <= 0)
                {
                    MessageBox.Show("请先选择要修改的行", "提示");
                    return;
                }
                DataGridViewRow row = rows[0];

                DeviceControlModify edit = new DeviceControlModify();
                edit.UniqueId = Convert.ToInt32(row.Cells["UniqueId"].Value);

                edit.ShowDialog();

                dataGridView1.DataSource = null;
                dataGridView1.DataSource = SysConfig.clientConfig.AllDevice;
            }
            catch (Exception ex)
            {
                LogMg.AddError(ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Add_Click(object sender, EventArgs e)
        {
            DeviceControlModify device = new DeviceControlModify();

            device.ShowDialog();

            dataGridView1.DataSource = null;
            dataGridView1.DataSource = SysConfig.clientConfig.AllDevice;
        }