Israel

Israel

  • 699
  • 1.3k
  • 217.3k

Last row doesnt been displayed

Sep 8 2018 11:01 AM
Hi!
 
I need that the last row of datagrid should be display the ID on my label. But it's doesnt works. Its doesnt show any error. Just the last row of the ID doesnt been displayed.
private void FolhaDeCaixa_Load(object sender, EventArgs e)
{
try
{
if (dgv.Rows.Count > 0)
{
lblID.Text = dgv.CurrentRow.Cells["ID"].Value.ToString();
lblAnex2.Text = dgv.CurrentRow.Cells["anex2"].Value.ToString();
dgv.CurrentCell = dgv.Rows[dgv.Rows.Count - 2].Cells["ID"];
}
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message, "my DGV");
}
 
 
 
 

Answers (2)