Hi,
I have a situation where I have a Windows Form and I have 2 classes defined
in the code, the primary form and a class that I got from the internet. I
have a label in the form that I would like the 2nd class to write to...so I
declared the label as "Public Shared". Which worked, I can write to it.
But I get an error when closing down visual studio, it says the label was
never declared and when i reopen Visual the label has disappeared off of the
form. When I go to put it back I get an error saying it already exists.
What is going on here? I simply need to write text to a label in the form
from a class.
Structure:
Public Class DTSConvertor725
Inherits System.Windows.Forms.Form
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents TestSQLConnection As System.Windows.Forms.Button
Public Shared label1 As System.Windows.Forms.Label
<code goes here>
End Class
Public Class PackageEventsSink
Inherits System.Windows.Forms.Form
Implements DTS.PackageEvents
Public fParentForm As DTSConvertor725
Overridable Overloads Sub OnStart(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnStart
Console.WriteLine("START in {0}", EventSource)
fParentForm.StepCount = fParentForm.StepCount + 1
fParentForm.label1.Text = "Step " & fParentForm.StepCount & " " &
EventSource
System.Windows.Forms.Application.DoEvents()
End Sub
End Class