MessageBox.Show(dataGridView1.Rows[0].Cells[0].Value as string);

解决方案 »

  1.   

    还是不行!!!!!
    请问一楼为什么messagebox中没有任何内容显示啊?我用的就是下面的语句。
    期待达人.....
    private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
            {
                    MessageBox.Show(dataGridView1.Rows[0].Cells[0].Value as string);
            }
      

  2.   

    另外as string 和我用tostring()方法是一样的效果吗?  谢谢
      

  3.   

    private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
            {
                MessageBox.Show(this.dataGridView1.CurrentCell.Value.ToString());
                MessageBox.Show(this.dataGridView1.CurrentCell.Value as string);
            }我的 怎么 都能用 ?
    是不是 恰好你的 dataGridView1.Rows[0].Cells[0].Value 为 null ?
    如果 是 null 则 tostring 会出错。