我试过2个 都不行
   1:dataGridView1.CurrentRow.Index != -1  不行。
   2:dataGridView1.Rows.Count>0   不行。   求有效的方法谢谢!!!

解决方案 »

  1.   

    dataGridView1.CurrentRow.Cells[0].Value.ToString()!=""   //依旧不行。
      

  2.   

    dataGridView1.DataSource as DataTable
    判断数据源
    dataGridView1.Rows.Count
      

  3.   

    试试这个
    if (dataGridView1.Rows.Count == 0)
    {
    MessageBox.Show("没有数据!");
    }
    else
    {
    this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
    }
      

  4.   

    提个问题啊:如果数据源有记录,但把dataGridView中的Row都隐藏起来,这样算有数据还是没有数据呢
      

  5.   

    问题 解决,应该是在DataSet里面判断!
    dset.Tables[0].Rows.Count > 0谢谢各位的提醒,与积极的帮忙解答!
      

  6.   

    绑定数据源之前判断行记录是否为空或Row为0不就行了吗
      

  7.   

    if (dataGridView1.Rows.Count == 0)
    {
    MessageBox.Show("没有数据!");
    }
    else
    {
    this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
    }
    这个可以的,但是如果dataGridView启用了添加,则将dataGridView1.Rows.Count == 0改为dataGridView1.Rows.Count == 1 方可