Jump to content

DataGridView


Ivo Pereira
 Share

Recommended Posts

Boas pessoal,

gostava de saber como eliminar uma linha de uma datagridview que tenha exactamente o mesmo conteúdo que a string x por exemplo.

    Sub Eliminar(ByVal URL As String)

        Dim url_row As New DataGridViewRow
        url_row.SetValues(URL)
        ' frmPainel.lst_videos.Items.Remove(URL)
        '   frmPainel.lst_videos.Refresh()
        frmPainel.dg_videos.Rows.Remove(url_row)
        frmPainel.dg_videos.Refresh()

    End Sub

Tenho algo deste género, até agora nada, já experimentei com o RemoveAt e com o Índex, nada.

Sugestões?

Link to comment
Share on other sites

Bom,

eu sinceramente já não sei se sou eu que não estou a actualizar bem, ou a eliminar bem.

Tenho este código agora:

    Sub EliminarFicheiro(ByVal URL As String)

        'Dim url_row As New DataGridViewRow
        'url_row.SetValues(URL)
        ' frmPainel.lst_videos.Items.Remove(URL)
        '   frmPainel.lst_videos.Refresh()
        For Each row In frmPainel.dg_videos.Rows
            If row.contains(URL) Then
                frmPainel.dg_videos.Rows.Remove(row)
            End If
        Next

        frmPainel.dg_videos.Update()
        frmPainel.dg_videos.Refresh()

    End Sub

O que está mal (a mais, a menos)?

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.