See changes (delete) in the vb.net grid

2

Hello, I would like you to help me with the following .. I have a form that does a search for a code with several grids and a button, this button makes a lot of changes in the various grids but I also want to delete some lines with one delete query that I created and although I deleted it in DB (which is what I want) I also wanted the lines to disappear from the grid .. how do I make them disappear automatically when I click the button? is that I can only see the grid without the lines when I re-enter the code for the search. Thank you

Public Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    TextBox1.Text = DGV1(5, 0).Value

    Dim i As Integer
    Dim j As Integer



    ' para preencher a coluna do potencial de prescrição (id = 8 para 5), RankId(48 para Selecção)
    'Perfil linico = 8, GroupId = 8 (Categoria - Médicos) 


    For i = 0 To DGV3.Rows.Count - 1
        Select Case DGV3(2, i).Value
            Case 26
                DGV3(9, i).Value = 8
                DGV3(5, i).Value = 48
                DGV3(23, i).Value = 8
                DGV3(6, i).Value = 84

        End Select

    Next
    EscreveEnterpriseDetails()


    'para nr de clinicas


    Dim Obs As String
    Obs = Trim(DGV1(20, 0).Value.ToString)
    For j = 0 To DGV5.Rows.Count - 2

        If Obs = "" Then

            Obs = checknull(DGV5(6, j).Value.ToString) & " - " & checknull(DGV5(7, j).Value.ToString) & " - " & checknull(DGV5(8, j).Value.ToString)

        Else

            Obs = Obs & Chr(13) & Chr(10) & checknull(DGV5(6, j).Value.ToString) & " - " & checknull(DGV5(7, j).Value.ToString) & " - " & checknull(DGV5(8, j).Value.ToString)

        End If


    Next

    ' MsgBox(Obs)


    DGV1(20, 0).Value = Obs
    DGV1(13, 0).Value = 0

    EscreverDoctorBasic()



    'para a morada 
    For j = 0 To DGV5.Rows.Count - 2
        DGV5(6, j).Value = "NÃO DEFINIDO" ' para a morada
        DGV5(7, j).Value = 421705           'para o codigo postal
        DGV5(8, j).Value = 0            'para o tipo local
        DGV5(9, j).Value = ""   ' para o horário
        DGV5(10, j).Value = True   ' visto para o LocalVisita

    Next
    EscreveAddress()

    ApagarRegistos()
    
asked by anonymous 10.12.2014 / 13:23

1 answer

1

Use Fill to populate your datagrid after deleting the data from your DB.

    
10.12.2014 / 18:30