Jump to content
ricduarte

[Resolvido] passar dados de datagridview para textbox's

Recommended Posts

ricduarte

boas!

tenho um pequeno problema. tou a fazer um programa de gestao e que queria fazer era: ao clicar numa linha da datagridview ,os dados dessa linha passavam para as textboxs.

será que alguém me pode ajudar?

Share this post


Link to post
Share on other sites
rezanov

No evento CellClick apanhas o index da linha que acabaste de clicar, a partir daí consegues essa linha com

datagridviewxpto.Rows[index]

(devolve um objecto do tipo DataGridViewRow) ... depois é so extrair a informaçao de acordo com as colunas (

objectxpto.Cells[nomedacoluna].Value

)

Edited by rezanov

Share this post


Link to post
Share on other sites
NunoDinis
Dim i As Integer
i = dg.CurrentRow.Index
textbox.text = dg.Item(0, i).Value


Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro.

ndsotware.org

Share this post


Link to post
Share on other sites
Leonardo Pereira

Maneira fácil,

TextBox . Text = DataGridView.CurrentRow.Cells(0).Value

Em cells (colunas) metes a que queres buscar o valor.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.