Whiteangel Posted March 2, 2014 at 07:06 PM Report #547281 Posted March 2, 2014 at 07:06 PM Boas pessoal, Como posso selecionar uma linha completa e enviar para as textbox, estou a fazer assim, mas so me envia pelo nome, e ja defini as propriedade SelectModal para FullRowSelect Dim contr As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Acer\Desktop\Base de Dados.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" ' Cria uma nova ligação à base de dados Dim db As New SqlConnection(contr) Dim SQL As String = "SELECT * FROM Categoria where Nome ='" & DataGridView1(1, DataGridView1.CurrentRow.Index).Value & "'" ' DataGridView1.CurrentCell = DataGridView1.Item(0, DataGridView1.Rows.GetLastRow(DataGridViewElementStates.Visible)) db.Open() Dim cmd As New SqlCommand(SQL, db) Dim dr As SqlClient.SqlDataReader dr = cmd.ExecuteReader Dim i As Integer = 0 While dr.Read() TxtCategoria.Text = dr.Item("Codigo_Categoria") Txtnome.Text = dr.Item("Nome") End While dr.Close() db.Close()
Diego Fernandes Posted March 5, 2014 at 03:02 AM Report #547553 Posted March 5, 2014 at 03:02 AM aqui tem um exemplo para selecionar o conteúdo da dgv http://www.macoratti.net/13/08/vbn_gvels.htm
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now