WinForm中DataGridView的 CellClick 事件的代码

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {

            PackageID = this.dataGridView1["PackageID", this.dataGridView1.CurrentCell.RowIndex].Value.ToString();

            this.txt_PackageName.Text = this.dataGridView1["PackageName", this.dataGridView1.CurrentCell.RowIndex].Value.ToString();
            this.txt_UsePrice.Text = this.dataGridView1["UsePrice", this.dataGridView1.CurrentCell.RowIndex].Value.ToString();
            this.txt_Price.Text = this.dataGridView1["Price", this.dataGridView1.CurrentCell.RowIndex].Value.ToString();
            this.txt_Validity.Text = this.dataGridView1["Validity", this.dataGridView1.CurrentCell.RowIndex].Value.ToString();
            this.comboBox_Category.Text = this.dataGridView1["Category", this.dataGridView1.CurrentCell.RowIndex].Value.ToString();
        }

你可能感兴趣的:(datagridview)