2
Answers

Last row doesnt been displayed

Photo of Israel

Israel

6y
576
1
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)