C
Christian Blackburn
Hi Gang,
I've had this happen with a couple of controls now, but my patience has worn
thin. Can somebody tell me why I can read/write to most objects on my form
from my module, but not when working with StatusBar.Text?
Thanks in Advance,
Christian Blackburn
My Code:
Public Class frmMain
Friend WithEvents StatusBar As System.Windows.Forms.StatusBar
'StatusBar
'
Me.StatusBar.Location = New System.Drawing.Point(0, 291)
Me.StatusBar.Name = "StatusBar"
Me.StatusBar.Size = New System.Drawing.Size(240, 22)
Me.StatusBar.TabIndex = 25
Me.StatusBar = New System.Windows.Forms.StatusBar
'frmMain
'
Me.Controls.Add(Me.StatusBar)
Private Sub mnuWriteToStatusBar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuWriteToStatusBar.Click
StatusBar.Text = "I'm from the form's code"
End Sub
Private Sub mnuAddToStatusBarFromModule_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuAddToStatusBarFromModule.Click
WriteToStatusBar()
End Sub
End Class
Module App
'Creates an object reference to our application's form, because otherwise we
can't work with it (lame-o)
Public objfrmMain As New frmMain
Public Sub WriteToStatusBar()
objfrmMain.StatusBar.Text = "I'm from the module."
End Sub
End Module
I've had this happen with a couple of controls now, but my patience has worn
thin. Can somebody tell me why I can read/write to most objects on my form
from my module, but not when working with StatusBar.Text?
Thanks in Advance,
Christian Blackburn
My Code:
Public Class frmMain
Friend WithEvents StatusBar As System.Windows.Forms.StatusBar
'StatusBar
'
Me.StatusBar.Location = New System.Drawing.Point(0, 291)
Me.StatusBar.Name = "StatusBar"
Me.StatusBar.Size = New System.Drawing.Size(240, 22)
Me.StatusBar.TabIndex = 25
Me.StatusBar = New System.Windows.Forms.StatusBar
'frmMain
'
Me.Controls.Add(Me.StatusBar)
Private Sub mnuWriteToStatusBar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuWriteToStatusBar.Click
StatusBar.Text = "I'm from the form's code"
End Sub
Private Sub mnuAddToStatusBarFromModule_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuAddToStatusBarFromModule.Click
WriteToStatusBar()
End Sub
End Class
Module App
'Creates an object reference to our application's form, because otherwise we
can't work with it (lame-o)
Public objfrmMain As New frmMain
Public Sub WriteToStatusBar()
objfrmMain.StatusBar.Text = "I'm from the module."
End Sub
End Module