2
Answers

Data from dataGrid doesnt show in my textboxs. Why?

Mfwamba Tshimanga

Mfwamba Tshimanga

10y
700
1
Hi!
 
My codes sound well. But I don't understand why when I scroll updown with my arrow from keyboard. Its doesnt show up on my textbox? 
 
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=localhost\\sqlexpress;Initial Catalog=master;Integrated Security=True");
if (e.RowIndex >= 0)
{
DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
codidoDataTempoRealFactu.Text = row.Cells["codigo"].Value.ToString();
designacaoDataTempoRealFactu.Text = row.Cells["designacao"].Value.ToString();
quantidadeDataTempoRealFactu.Text = row.Cells["quantidade"].Value.ToString();
precocompraDataTempoRealFactu.Text = row.Cells["preco_compra"].Value.ToString();
valorDataTempoRealFactu.Text = row.Cells["valor"].Value.ToString();
totalDataTempoRealFactu.Text = row.Cells["total"].Value.ToString();
}
}
}
}
 

Answers (2)