//DataGridViewRow dgvr = dataGridView1.CurrentRow;
//DataRowView drv = (DataRowView)dgvr.DataBoundItem;
//MessageBox.Show(drv.Row[0].ToString());//选中行的值,[0]表是第一列的值
//MessageBox.Show(dgvr.DataBoundItem.ToString());//真实的值数据绑定对象类型
//DataRowView drv = (DataRowView)dgvr.DataBoundItem;
//MessageBox.Show(drv.Row[0].ToString());//选中行的值,[0]表是第一列的值
//MessageBox.Show(dgvr.DataBoundItem.ToString());//真实的值数据绑定对象类型
//DataGridViewCell dc = this.dataGridView1.CurrentCell;
//MessageBox.Show(dc.ToString());//选中的单元格的位置
//DataGridViewCell dgvc = this.dataGridView1.CurrentCell;
//MessageBox.Show(dgvc.Value.ToString());//选中的单元格的值
//获取选中的单元格的值,把datagridview设为选择时是选中整行的话[3]就表示是选中的第四列的值
MessageBox.Show(this.dataGridView1.SelectedCells[0].Value.ToString());
int indexPoint= dataGridView1.CurrentRow.Index;
//设置绑定数据源后是否自动创建列
this.dgvRoomType.AutoGenerateColumns = false;