OK. That was the trick I was forgetting - to pass the form in as an
argument. Man, I wasn't thinking about "New" that is not the same instance
of the original form. Now it works correctly.
Thanks very much for your help.
Rich
"Ken Tucker [MVP]" wrote:
Hi,
You need to pass a reference to the form to the class. In your
example you created a new form1 and changed the captiontext. The form was
never shown. Try something like this instead.
Public Class clsTest
Public Sub New(frm as form1)
frm.captionText = "test from clsTest"
End Sub
End Class
Ken
-------------------------
"Rich" <Ri**@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com...
--button on the form
Private Sub btnClsTest_Click(...) Handles btnClsTest.Click
Dim a As New clsTest
End Sub
-------------------------------------------------------
'--property on my form
Public Property captionText() As String
Get
End Get
Set(ByVal Value As String)
Me.Text = Value
End Set
End Property
------------------------------------------------
Public Class clsTest
Public Sub New()
Dim frm As New Form1
frm.captionText = "test from clsTest"
End Sub
End Class
How can I make the text "test from clsTest" in the class constructor show
up in the caption bar of the form that instantiates this class?
Thanks,
Rich