Hi All,
I have a Sub Routine in a module to iterate controls on a form. I get an error about an instance of the object not created.
I have declared the object and set it to the form (ModelsBox = Me). I have done this between two forms previously. Is there something fundamental that I am missing. Is this where the "Friend Shared" comes into play?
Thanks in advance,Code:Namespace Models_DialogBox Public Class Mod_DlgBox <CommandMethod("EM")> _ Public Sub EM() LoadForm() End Sub End Class End Namespace Friend Module Module1 Friend ModelsBox As Form Public Sub LoadForm() Dim Models As Form = New FrmModBox Models.Show() End Sub Public Sub UpdateStatus() For Each oControl As Control In ModelsBox.Controls("TableLayoutPanel1").Controls ' This is the error ' my code Next End Sub End Module Friend Class FrmModBox Private Sub FrmModBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ModelsBox = Me End Sub End Class
Brent




Reply With Quote