CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    Refresh another form on button Click

    Hallo,

    I have a form called FrmPracDetails which is built up with a List view called LvwColProc.

    Therefore when you click a field on the LvwColProc it takes you to another form called FrmColProcessing, here you can make changes to certain fields which are also present on FrmPracDetails.

    What I want to do is when you make changes on FrmColProcesing and Click the Save Button (which calls the Save function)the changes appear instantly on FrmPracDetails.

    Please note, FrmColProcessing will always be open next to FrmPracDetails.

    I have tried to put this code in the Save function present in FrmColProcessing as shown below, but it doesnt Refresh FrmPracDetails form.

    Any ideas please, thanks



    Code:
    Private Sub Save()
    
            Dim conn As SqlConnection = GetDbConnection()
            Dim query As String
            Dim cmd As New SqlCommand
    
            Try
    
                query = "UPDATE gprdsql.TblCollections SET Additional_info ='" & _
                               TxtAddInfo.Text & "' where col_uid='" & _
                               TextBox3.Text & "'"
                cmd = New SqlCommand(query, conn)
                cmd.ExecuteNonQuery()
    
                query = "UPDATE gprdsql.TblCollections SET stage ='" & _
                              CboColStage.Text & "' where col_uid='" & _
                              TextBox3.Text & "'"
                cmd = New SqlCommand(query, conn)
                cmd.ExecuteNonQuery()
    
    
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Information, "GCPM")
            End Try
    
            MsgBox("Details have been updated", MsgBoxStyle.Information, "GCPM")
    
            FrmPracDetails.LvwColProc.Refresh()
    
    
        End Sub
    Last edited by HanneSThEGreaT; August 11th, 2009 at 08:16 AM. Reason: Code Tags!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured