Chamuanza Posted February 19, 2009 at 07:16 PM Report Share #245594 Posted February 19, 2009 at 07:16 PM Um bem aja a todos Estou utilizando o VB2005 Express Não estou conseguindo deslocar o ponteiro da dataGridView para a posição desejada (linha nº com o valor de comboBoxNo.Text) Junto o evento onde estou tentando - Será que neste evento posso fazer o que pretendo? Private Sub comboBoxNo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboBoxNo.SelectedIndexChanged Try dSet.Tables(0).PrimaryKey = New DataColumn() {dSet.Tables(0).Columns("NO_0")} Dim row As DataRow row = dSet.Tables(0).Rows.Find(comboBoxNo.Text) txtBoxNo.Text = row("NO_0") txtBoxName.Text = row("NAME_0") txtBoxGender.Text = row("GENDER_0") txtBoxDepartment.Text = row("DEPARTMENT_0") txtBoxTotalMark.Text = row("TOTALMARK_0") btnUpdate.Enabled = True btnDelete.Enabled = True txtBoxNo.ReadOnly = True btnAdd.Enabled = False 'Conta o nº de linhas da grid 'Dim NumeroLinha As Integer = Me.dataGridView.Rows.Count - 1 'TextBox1.Text = NumeroLinha Dim NumeroLinha As Integer = comboBoxNo.Text TextBox1.Text = NumeroLinha Me.dataGridView.row ?????????????????????????????????????????????? Catch ex As Exception MsgBox(ex.ToString()) End Try End Sub Desde já um obrigado Link to comment Share on other sites More sharing options...
jpaulino Posted February 19, 2009 at 08:42 PM Report Share #245617 Posted February 19, 2009 at 08:42 PM Para deslocares o ponteiro da datagridview fazes o seguinte: Me.dataGridView.CurrentCell = Me.dataGridView.Rows(1).Cells(0) seleccionando deste modo a linha nº 1 No entanto, e se queres um valor de uma célula e não uma posição (1 no exemplo que te dei) tens de procurar o index dessa linha na datagridview. Tens aqui alguns exemplos: VB.NET: Utilizando o controlo DataGridView Link to comment Share on other sites More sharing options...
Chamuanza Posted February 19, 2009 at 09:37 PM Author Report Share #245661 Posted February 19, 2009 at 09:37 PM Problema Resolvido Agradeço a Informação Link to comment Share on other sites More sharing options...
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