0

VB.net 2010 being used. I have 2 forms (say Form1 and Form2). Form1 upon load loads a grid. User may select row from grid for maintenance. Ideally, when Form2 closed grid in Form1 is reloaded.

If I process as Form2.ShowDialog then all works fine. If I process as Form2.Show then I have added code to fire a change to reload the grid, this seems to function as desired (via debug I see the event to reload the grid being run).

When I run Form2.Show and Form2 closes the following code is executed.

Private Sub sbrReset()
    Try
        GridControl1.DataSource = Nothing
        GridView1.Columns.Clear()
        dsGrid1.Clear()

        Using cmd As New SqlClient.SqlCommand("spInventoryControlMtnFiberSize", GetOpenConnection) With {.CommandType = CommandType.StoredProcedure}
            With cmd.Parameters
                .Add(New SqlParameter("@Action", SqlDbType.Int)).Value = 23
            End With

            daGrid1.SelectCommand = cmd
            daGrid1.Fill(dsGrid1, "table")
            bsGrid1.DataSource = dsGrid1

        End Using
        GridControl1.DataSource = dsGrid1.Tables("table")


        GridView1.BestFitColumns()
        GridView1.Columns(0).Fixed = Columns.FixedStyle.Left
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try
End Sub

Changes made to the database are not showing up in Form1 grid when grid reloaded. When I debug dsGrid1 shows the new value, but the grid on the form does not show new value.

user990423
  • 1,397
  • 2
  • 12
  • 32

0 Answers0