Link to home
Start Free TrialLog in
Avatar of bertino12
bertino12

asked on

Problem with GUI not updating in MDI

I have a MDI parent form (frmMain.vb). When I call a form(Import.vb) in it I cant get the interface to update. When I set the form (Import.vb) as the startup form it works just fine.

Here is the code im using:

FORM MAIN (frmMain.vb)
Imports System.Windows.Forms

Public Class frmMain
    Private Sub ImportToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImportToolStripMenuItem.Click
        Dim frmChild As New Import
        frmChild.MdiParent = Me
        frmChild.Show()
    End Sub
End Class

FORM IMPORT (Import.vb)
Imports System.Configuration.ConfigurationSettings

Public Class Import
    Private excelObj As New Sys.Cap.Data.ExcelObj
    Private formImport As Import

    Private Sub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
        excelObj.PopExcel(formImport)
    End Sub
End Class

EXCEL OBJ (ExcelObj.vb)
Namespace Sys.Cap.Data
    Public Class ExcelObj
        Private formImport As Import

        Public Sub PopExcel(ByRef frm As Import)
            formImport = Import
            formImport.Label1.Text = "TEST"
            formImport.Refresh()
            Exit Sub
        End Sub
    End Class
End Namespace

Any idea why the label updates properly when I set Import.VB as the startup form and doesnt update at all when I set the frmMain.VB as the startup form?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bertino12
bertino12

ASKER

Thank you very much for your time.