Jump to content

actualizar dados gridview- TextBox


dioguito
 Share

Recommended Posts

1º - definir o modo de selecção da grid para FullRowSelect

2º - Capturar o evento RowEnter da grid:

private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)

        {

         

        }

3º - Nesse evento, preencher as textboxes de acordo com a Row seleccionada, utilizando o argumento "e" do evento:

        TextBox1.Text  = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();

        TextBox2.Text  = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();

A única coisa que tens de mudar é número da coluna correspondente para o que queres enviar para cada textbox. Espero que tenha ajudado.

Oracle Certified Professional - AdministraçãoOracle Certified Professional - Pl/sqlMCPD - Microsoft Certified Professional DeveloperMCTS - Microsoft Certified Technology Specialist

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.