Problems with my ShowDialog vb.NET form

0

I'm doing an application in VB.NET and I have a complication that I had not noticed. It turns out that from a main form [ frmInventario ] I perform an operation through a procedure and show the result in another window frmCoincidentes , to open this window I use the method showDialog() of VB.NET

When I open it for the first time everything is excellent, but when I close the form and if I open it again, I do not perform the operation I want.

That's the way I open the frm

Private Sub btnVerAdicionales_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVerAdicionales.Click
        LlenarExistencias()
        llenarUNION()

        If CInt(frmCoincidentes.DataGridView2.Rows.Count) > 0 Then
            frmCoincidentes.ShowDialog()
        Else
            MsgBox("Falta Informacion.", MsgBoxStyle.Information, "Info Adicionales")
        End If
    End Sub
  

NOTE: To load the data again, I have to close the application   completely and then reopen it.

    
asked by SdeSistemas 10.10.2018 в 18:51
source

1 answer

1

A POSSIBLE solution. I had a similar event, and what solved the problem was that in the FormClosed event of the modal form I called the Dispose method to DESTROY COMPLETELY the instances of it.

Private Sub frmCoincidentes_FormClosed(...) Handles Me.FormClosed
    Me.Dispose()
End Sub

Sometimes when the form is "Cierran" , rather than closing the form what is actually being done is to hide it, which does not trigger any closing event. Since the form is hidden, it can be displayed again without the need to create a new instance of it.

There may be a conflict that does not calculate the data you want.

    
answered by 10.10.2018 / 19:28
source