Datagridview doubt in C#

Asked

Viewed 25 times

0

I would like to know what is and what these types of codes are used for:

txtCodigo.Text = dtgProfessores.Rows[e.RowIndex].Cells["CODIGO"].Value.ToString();
txtNome.Text = dtgProfessores.Rows[e.RowIndex].Cells["NOME"].Value.ToString();
txtEndereco.Text = dtgProfessores.Rows[e.RowIndex].Cells["ENDERECO"].Value.ToString();
txtBairro.Text = dtgProfessores.Rows[e.RowIndex].Cells["BAIRRO"].Value.ToString();
txtCidade.Text = dtgProfessores.Rows[e.RowIndex].Cells["CIDADE"].Value.ToString();

I would like a clear and simple explanation. Thank you very much :)

  • They are probably used for content editing when selecting a line from the Gridview dtgProfessores, or just displaying in another context.

  • We have a DataGridView, catching the CELL ["CODIGO"] converting its value to String and assigning it to txtCodigo.Text and so on...

1 answer

0

The same goes for everyone carrying I will explain only the first! He takes from the Component DataGridView, the element on the line e.RowIndex, the column "Codigo" and in this column the value that is inside there it converts using .toString() the value la inside for String, and then put inside the txtCodigo.text.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.