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_Cl ick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImportToolStripMenuItem.Cl ick
Dim frmChild As New Import
frmChild.MdiParent = Me
frmChild.Show()
End Sub
End Class
FORM IMPORT (Import.vb)
Imports System.Configuration.Confi gurationSe ttings
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(formImpo rt)
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?
Here is the code im using:
FORM MAIN (frmMain.vb)
Imports System.Windows.Forms
Public Class frmMain
Private Sub ImportToolStripMenuItem_Cl
Dim frmChild As New Import
frmChild.MdiParent = Me
frmChild.Show()
End Sub
End Class
FORM IMPORT (Import.vb)
Imports System.Configuration.Confi
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(formImpo
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER