Re: Accesing form controls from another class than the one tha created them

by Mike on 11/1/2007 9:17:00 AM Any Example to help me

-----Original Message-----
From: Jack Jackson [mailto:jacknospam@pebbleridge.com]
Posted At: Saturday, October 27, 2007 10:43 AM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: Accesing form controls from another class than the one tha
created them
Subject: Re: Accesing form controls from another class than the one tha
created them

You don't show how the variable frmCall in form2 gets set. How does
form1 pass a reference to itself to form2?

On Sat, 27 Oct 2007 01:56:55 -0400, "Mike" <mike@hitnext.com> wrote:

>
>Form 1 (frmCall)
>
>Public Property TextboxWTN() As String
> Get
> Return Me.txtWTN.Text
> End Get
> Set(ByVal value As String)
> Me.txtWTN.Text = value
> End Set
>End Property
>
>
>Form 2
>
>frmCall.TextboxWTN = "Something"
>
>
>This is all I have
>
>Thanks
>
>
>
>-----Original Message-----
>From: rowe_newsgroups [mailto:rowe_email@yahoo.com]
>Posted At: Friday, October 26, 2007 6:36 AM
>Posted To: microsoft.public.dotnet.languages.vb
>Conversation: Accesing form controls from another class than the one
tha
>created them
>Subject: Re: Accesing form controls from another class than the one tha
>created them
>
>On Oct 25, 11:06 pm, "Mike" <m...@hitnext.com> wrote:
>> This is the property definition:
>>
>> Public Property TextboxWTN() As String
>> Get
>> Return Me.txtWTN.Text
>> End Get
>> Set(ByVal value As String)
>> Me.txtWTN.Text = value
>> End Set
>> End Property
>>
>> And from the other form I call frmMain.TextboxWTN = "Whatever"
>>
>> It has no effect over the form's textbox.
>>
>> Thanks
>>
>> -----Original Message-----
>> From: Jack Jackson [mailto:jacknos...@pebbleridge.com]
>>
>> Posted At: Thursday, October 25, 2007 9:52 PM
>> Posted To: microsoft.public.dotnet.languages.vb
>> Conversation: Accesing form controls from another class than the one
>tha
>> created them
>> Subject: Re: Accesing form controls from another class than the one
>tha
>> created them
>>
>> It is the first, where frmMain is a reference to the existing first
>> form that you somehow passed into the second form.
>>
>> The second piece of code creates a new instance of your form, not
>> something that you want to do.
>>
>> By the way, saying "none of them seem to work" without giving any
>> details is not very useful. Error message? No error but had no
>> effect? Had an effect you did not want?
>>
>> What does the property definition in form1 look like?
>>
>> On Thu, 25 Oct 2007 14:43:54 -0400, "Mike" <m...@hitnext.com> wrote:
>>
>> >Ok, I did, buy from the 2nd form, how do I reference the forms'
>> >property?
>>
>> >Is it a direct call, like:
>>
>> >frmMain.Myproperty = MyValue
>>
>> >or
>>
>> >Dim frm As new frmMain
>> >With frmMain
>> > .MyProperty = MyValue
>> >End With
>>
>> >I have tried both an none of them seem to work.
>>
>> >Thanks!
>>
>> >-----Original Message-----
>> >From: rowe_newsgroups [mailto:rowe_em...@yahoo.com]
>> >Posted At: Thursday, October 25, 2007 2:01 PM
>> >Posted To: microsoft.public.dotnet.languages.vb
>> >Conversation: Accesing form controls from another class than the one
>> tha
>> >created them
>> >Subject: Re: Accesing form controls from another class than the one
>tha
>> >created them
>>
>> >On Oct 25, 11:34 am, "Mike" <m...@hitnext.com> wrote:
>> >> Hi,
>>
>> >> I have a form with some controls, and a different class that needs
>to
>> >> modify some control properties at run time.
>>
>> >> Hoy can I reference the from so I have access to its controls and
>> >> therefore being able to modify its properties?
>>
>> >> Regards,
>>
>> >> Mike
>>
>> >My personal preference is to keep the Controls private, and only
>> >expose the necessary functionality via properties. This prevents an
>> >outside object from being able to modify more than you want to have
>> >modified.
>>
>> >For example, if you want a second form to be able to modify a
label's
>> >text property expose it like this:
>>
>> >////////////
>> >Public Property MyLabelText() As String
>> > Get
>> > Return MyLabel.Text
>> > End Get
>> > Set (ByVal value As String)
>> > MyLabel.Text = value
>> > End Get
>> >End Property
>> >///////////
>>
>> >If instead you gave them a complete reference to the label, nothing
>> >would stop them from calling form.MyLabel.Dispose() or something
else
>> >you didn't intend. In other words, using a property maintains
>> >encapsulation.
>>
>> >Thanks,
>>
>> >Seth Rowe
>
>Are you sure you have a reference to the other form? If you
>instantiate an new "frmMain" like you did in a previous example, you
>will not be accomplishing anything. Perhaps you could post the code
>where you are retrieving the reference to frmMain?
>
>Thanks,
>
>Seth Rowe

 

Re: Accesing form controls from another class than the one tha created them

by Jack Jackson on 11/1/2007 5:31:00 AM Since I have no clue what you are doing, all I can do is give an
example.

Suppose form1 creates form2, maybe in the Click event of a button:

dim frm As New Form2(Me)
frm.Show()
 or
frm.ShowDialog()

In form2:

Private form1 as Form1

Public New(frm1 as Form1)

  form1 = frm1

  Me.InitializeComponent()

End Sub

In form 2 when you want to reference form1:

form1.xxx

On Thu, 1 Nov 2007 13:16:47 -0400, "Mike" <mike@hitnext.com> wrote:

>Any Example to help me
>
>-----Original Message-----
>From: Jack Jackson [mailto:jacknospam@pebbleridge.com]
>Posted At: Saturday, October 27, 2007 10:43 AM
>Posted To: microsoft.public.dotnet.languages.vb
>Conversation: Accesing form controls from another class than the one tha
>created them
>Subject: Re: Accesing form controls from another class than the one tha
>created them
>
>You don't show how the variable frmCall in form2 gets set. How does
>form1 pass a reference to itself to form2?
>
>On Sat, 27 Oct 2007 01:56:55 -0400, "Mike" <mike@hitnext.com> wrote:
>
>>
>>Form 1 (frmCall)
>>
>>Public Property TextboxWTN() As String
>> Get
>> Return Me.txtWTN.Text
>> End Get
>> Set(ByVal value As String)
>> Me.txtWTN.Text = value
>> End Set
>>End Property
>>
>>
>>Form 2
>>
>>frmCall.TextboxWTN = "Something"
>>
>>
>>This is all I have
>>
>>Thanks
>>
>>
>>
>>-----Original Message-----
>>From: rowe_newsgroups [mailto:rowe_email@yahoo.com]
>>Posted At: Friday, October 26, 2007 6:36 AM
>>Posted To: microsoft.public.dotnet.languages.vb
>>Conversation: Accesing form controls from another class than the one
>tha
>>created them
>>Subject: Re: Accesing form controls from another class than the one tha
>>created them
>>
>>On Oct 25, 11:06 pm, "Mike" <m...@hitnext.com> wrote:
>>> This is the property definition:
>>>
>>> Public Property TextboxWTN() As String
>>> Get
>>> Return Me.txtWTN.Text
>>> End Get
>>> Set(ByVal value As String)
>>> Me.txtWTN.Text = value
>>> End Set
>>> End Property
>>>
>>> And from the other form I call frmMain.TextboxWTN = "Whatever"
>>>
>>> It has no effect over the form's textbox.
>>>
>>> Thanks
>>>
>>> -----Original Message-----
>>> From: Jack Jackson [mailto:jacknos...@pebbleridge.com]
>>>
>>> Posted At: Thursday, October 25, 2007 9:52 PM
>>> Posted To: microsoft.public.dotnet.languages.vb
>>> Conversation: Accesing form controls from another class than the one
>>tha
>>> created them
>>> Subject: Re: Accesing form controls from another class than the one
>>tha
>>> created them
>>>
>>> It is the first, where frmMain is a reference to the existing first
>>> form that you somehow passed into the second form.
>>>
>>> The second piece of code creates a new instance of your form, not
>>> something that you want to do.
>>>
>>> By the way, saying "none of them seem to work" without giving any
>>> details is not very useful. Error message? No error but had no
>>> effect? Had an effect you did not want?
>>>
>>> What does the property definition in form1 look like?
>>>
>>> On Thu, 25 Oct 2007 14:43:54 -0400, "Mike" <m...@hitnext.com> wrote:
>>>
>>> >Ok, I did, buy from the 2nd form, how do I reference the forms'
>>> >property?
>>>
>>> >Is it a direct call, like:
>>>
>>> >frmMain.Myproperty = MyValue
>>>
>>> >or
>>>
>>> >Dim frm As new frmMain
>>> >With frmMain
>>> > .MyProperty = MyValue
>>> >End With
>>>
>>> >I have tried both an none of them seem to work.
>>>
>>> >Thanks!
>>>
>>> >-----Original Message-----
>>> >From: rowe_newsgroups [mailto:rowe_em...@yahoo.com]
>>> >Posted At: Thursday, October 25, 2007 2:01 PM
>>> >Posted To: microsoft.public.dotnet.languages.vb
>>> >Conversation: Accesing form controls from another class than the one
>>> tha
>>> >created them
>>> >Subject: Re: Accesing form controls from another class than the one
>>tha
>>> >created them
>>>
>>> >On Oct 25, 11:34 am, "Mike" <m...@hitnext.com> wrote:
>>> >> Hi,
>>>
>>> >> I have a form with some controls, and a different class that needs
>>to
>>> >> modify some control properties at run time.
>>>
>>> >> Hoy can I reference the from so I have access to its controls and
>>> >> therefore being able to modify its properties?
>>>
>>> >> Regards,
>>>
>>> >> Mike
>>>
>>> >My personal preference is to keep the Controls private, and only
>>> >expose the necessary functionality via properties. This prevents an
>>> >outside object from being able to modify more than you want to have
>>> >modified.
>>>
>>> >For example, if you want a second form to be able to modify a
>label's
>>> >text property expose it like this:
>>>
>>> >////////////
>>> >Public Property MyLabelText() As String
>>> > Get
>>> > Return MyLabel.Text
>>> > End Get
>>> > Set (ByVal value As String)
>>> > MyLabel.Text = value
>>> > End Get
>>> >End Property
>>> >///////////
>>>
>>> >If instead you gave them a complete reference to the label, nothing
>>> >would stop them from calling form.MyLabel.Dispose() or something
>else
>>> >you didn't intend. In other words, using a property maintains
>>> >encapsulation.
>>>
>>> >Thanks,
>>>
>>> >Seth Rowe
>>
>>Are you sure you have a reference to the other form? If you
>>instantiate an new "frmMain" like you did in a previous example, you
>>will not be accomplishing anything. Perhaps you could post the code
>>where you are retrieving the reference to frmMain?
>>
>>Thanks,
>>
>>Seth Rowe
 

Re: Accesing form controls from another class than the one tha created them

by Mike on 11/2/2007 9:35:00 AM This is a multi-part message in MIME format.

------=_NextPart_000_003E_01C81D55.246ABDE0
Content-Type: text/plain;
   charset="us-ascii"
Content-Transfer-Encoding: 7bit

OK, this is what I'm trying to do.


I have a form that requests from a singleton service.
This service has some events that needs to be wired in the client side.


Public class Form1

-> here I declare a property called <TextboxAccess> that sets and gets
text text property a text box


.... from stuff

End Class


Public Class SingletonCallBack

Public sub SomeEvent

   From1.TextboxAccess = "Some text"

End Sub


EndClass



This is not working for me, and there is no exceptions at all.
Even more, when I debug, I see text property of the textbox control in
form1 to get the info I pass on, but it does nor display it.

Thanks








-----Original Message-----
From: Jack Jackson [mailto:jacknospam@pebbleridge.com]
Posted At: Thursday, November 01, 2007 3:31 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: Accesing form controls from another class than the one tha
created them
Subject: Re: Accesing form controls from another class than the one tha
created them

Since I have no clue what you are doing, all I can do is give an
example.

Suppose form1 creates form2, maybe in the Click event of a button:

dim frm As New Form2(Me)
frm.Show()
 or
frm.ShowDialog()

In form2:

Private form1 as Form1

Public New(frm1 as Form1)

  form1 = frm1

  Me.InitializeComponent()

End Sub

In form 2 when you want to reference form1:

form1.xxx

On Thu, 1 Nov 2007 13:16:47 -0400, "Mike" <mike@hitnext.com> wrote:

>Any Example to help me
>
>-----Original Message-----
>From: Jack Jackson [mailto:jacknospam@pebbleridge.com]
>Posted At: Saturday, October 27, 2007 10:43 AM
>Posted To: microsoft.public.dotnet.languages.vb
>Conversation: Accesing form controls from another class than the one
tha
>created them
>Subject: Re: Accesing form controls from another class than the one tha
>created them
>
>You don't show how the variable frmCall in form2 gets set. How does
>form1 pass a reference to itself to form2?
>
>On Sat, 27 Oct 2007 01:56:55 -0400, "Mike" <mike@hitnext.com> wrote:
>
>>
>>Form 1 (frmCall)
>>
>>Public Property TextboxWTN() As String
>> Get
>> Return Me.txtWTN.Text
>> End Get
>> Set(ByVal value As String)
>> Me.txtWTN.Text = value
>> End Set
>>End Property
>>
>>
>>Form 2
>>
>>frmCall.TextboxWTN = "Something"
>>
>>
>>This is all I have
>>
>>Thanks
>>
>>
>>
>>-----Original Message-----
>>From: rowe_newsgroups [mailto:rowe_email@yahoo.com]
>>Posted At: Friday, October 26, 2007 6:36 AM
>>Posted To: microsoft.public.dotnet.languages.vb
>>Conversation: Accesing form controls from another class than the one
>tha
>>created them
>>Subject: Re: Accesing form controls from another class than the one
tha
>>created them
>>
>>On Oct 25, 11:06 pm, "Mike" <m...@hitnext.com> wrote:
>>> This is the property definition:
>>>
>>> Public Property TextboxWTN() As String
>>> Get
>>> Return Me.txtWTN.Text
>>> End Get
>>> Set(ByVal value As String)
>>> Me.txtWTN.Text = value
>>> End Set
>>> End Property
>>>
>>> And from the other form I call frmMain.TextboxWTN = "Whatever"
>>>
>>> It has no effect over the form's textbox.
>>>
>>> Thanks
>>>
>>> -----Original Message-----
>>> From: Jack Jackson [mailto:jacknos...@pebbleridge.com]
>>>
>>> Posted At: Thursday, October 25, 2007 9:52 PM
>>> Posted To: microsoft.public.dotnet.languages.vb
>>> Conversation: Accesing form controls from another class than the one
>>tha
>>> created them
>>> Subject: Re: Accesing form controls from another class than the one
>>tha
>>> created them
>>>
>>> It is the first, where frmMain is a reference to the existing first
>>> form that you somehow passed into the second form.
>>>
>>> The second piece of code creates a new instance of your form, not
>>> something that you want to do.
>>>
>>> By the way, saying "none of them seem to work" without giving any
>>> details is not very useful. Error message? No error but had no
>>> effect? Had an effect you did not want?
>>>
>>> What does the property definition in form1 look like?
>>>
>>> On Thu, 25 Oct 2007 14:43:54 -0400, "Mike" <m...@hitnext.com> wrote:
>>>
>>> >Ok, I did, buy from the 2nd form, how do I reference the forms'
>>> >property?
>>>
>>> >Is it a direct call, like:
>>>
>>> >frmMain.Myproperty = MyValue
>>>
>>> >or
>>>
>>> >Dim frm As new frmMain
>>> >With frmMain
>>> > .MyProperty = MyValue
>>> >End With
>>>
>>> >I have tried both an none of them seem to work.
>>>
>>> >Thanks!
>>>
>>> >-----Original Message-----
>>> >From: rowe_newsgroups [mailto:rowe_em...@yahoo.com]
>>> >Posted At: Thursday, October 25, 2007 2:01 PM
>>> >Posted To: microsoft.public.dotnet.languages.vb
>>> >Conversation: Accesing form controls from another class than the
one
>>> tha
>>> >created them
>>> >Subject: Re: Accesing form controls from another class than the one
>>tha
>>> >created them
>>>
>>> >On Oct 25, 11:34 am, "Mike" <m...@hitnext.com> wrote:
>>> >> Hi,
>>>
>>> >> I have a form with some controls, and a different class that
needs
>>to
>>> >> modify some control properties at run time.
>>>
>>> >> Hoy can I reference the from so I have access to its controls and
>>> >> therefore being able to modify its properties?
>>>
>>> >> Regards,
>>>
>>> >> Mike
>>>
>>> >My personal preference is to keep the Controls private, and only
>>> >expose the necessary functionality via properties. This prevents an
>>> >outside object from being able to modify more than you want to have
>>> >modified.
>>>
>>> >For example, if you want a second form to be able to modify a
>label's
>>> >text property expose it like this:
>>>
>>> >////////////
>>> >Public Property MyLabelText() As String
>>> > Get
>>> > Return MyLabel.Text
>>> > End Get
>>> > Set (ByVal value As String)
>>> > MyLabel.Text = value
>>> > End Get
>>> >End Property
>>> >///////////
>>>
>>> >If instead you gave them a complete reference to the label, nothing
>>> >would stop them from calling form.MyLabel.Dispose() or something
>else
>>> >you didn't intend. In other words, using a property maintains
>>> >encapsulation.
>>>
>>> >Thanks,
>>>
>>> >Seth Rowe
>>
>>Are you sure you have a reference to the other form? If you
>>instantiate an new "frmMain" like you did in a previous example, you
>>will not be accomplishing anything. Perhaps you could post the code
>>where you are retrieving the reference to frmMain?
>>
>>Thanks,
>>
>>Seth Rowe

------=_NextPart_000_003E_01C81D55.246ABDE0
Content-Type: text/html;
   charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
08.00.0681.000">
<TITLE>Re: Accesing form controls from another class than the one tha =
created them</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">OK, this is =
what</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">I</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">'m trying to do.</FONT></SPAN></P>
<BR>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">I have a form =
that requests from a singleton service.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">This service =
has some events that needs to be wired in the client =
side.</FONT></SPAN></P>
<BR>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Public =
class</FONT></SPAN><SPAN LANG=3D"en-us"><B> <FONT =
FACE=3D"Consolas">Form1</FONT></B></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">-&gt; =
here</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">I</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas"> declare a</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">property</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">called</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">&lt;</FONT></SPAN><SPAN LANG=3D"en-us"><B><FONT =
FACE=3D"Consolas">TextboxAccess</FONT></B></SPAN><SPAN =
LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt; that sets and gets text text =
property a text box</FONT></SPAN><SPAN LANG=3D"en-us"></SPAN></P>
<BR>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">... from =
stuff</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">End =
Class</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Public Class =
SingletonCallBack</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Public sub =
SomeEvent</FONT></SPAN></P>

<P DIR=3DLTR><SPAN =
LANG=3D"en-us"><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
FACE=3D"Consolas">From1</FONT></B></SPAN><SPAN LANG=3D"en-us"><B><FONT =
FACE=3D"Consolas">.</FONT></B></SPAN><SPAN LANG=3D"en-us"><B><FONT =
FACE=3D"Consolas">TextboxAccess</FONT></B></SPAN><SPAN =
LANG=3D"en-us"><B><FONT FACE=3D"Consolas"> =3D &quot;Some =
text&quot;</FONT></B></SPAN><SPAN LANG=3D"en-us"><B></B></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">End =
Sub</FONT></SPAN></P>
<BR>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">EndClass</FONT></SPAN><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>
<BR>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">This is not =
working for me, and there is no exceptions at all.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Even more, =
when</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">I</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas"> debug,</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">I</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas"> see text property of the textbox control in form1 to =
get the info</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
FACE=3D"Consolas">I</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas"> pass on, but it does nor display =
it.</FONT></SPAN><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">Thanks</FONT></SPAN></P>
<BR>
<BR>
<BR>
<BR>
<BR>

<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">-----Original =
Message-----<BR>
From: Jack Jackson [<A =
HREF=3D"mailto:jacknospam@pebbleridge.com">mailto:jacknospam@pebbleridge.=
com</A>]<BR>
Posted At: Thursday, November 01, 2007 3:31 PM<BR>
Posted To: microsoft.public.dotnet.languages.vb<BR>
Conversation: Accesing form controls from another class than the one tha =
created them<BR>
Subject: Re: Accesing form controls from another class than the one tha =
created them</FONT></SPAN><SPAN LANG=3D"en-us"></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Since I have =
no clue what you are doing, all I can do is give an</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">example.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Suppose form1 =
creates form2, maybe in the Click event of a button:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">dim frm As New =
Form2(Me)</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">frm.Show()</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&nbsp;or =
</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">frm.ShowDialog()</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">In =
form2:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Private form1 =
as Form1</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">Public =
New(frm1 as Form1)</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&nbsp; form1 =
=3D frm1</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&nbsp; =
Me.InitializeComponent()</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">End =
Sub</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">In form 2 when =
you want to reference form1:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">form1.xxx</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">On Thu, 1 Nov =
2007 13:16:47 -0400, &quot;Mike&quot; &lt;mike@hitnext.com&gt; =
wrote:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;Any =
Example to help me</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;-----Original Message-----</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;From: Jack =
Jackson [<A =
HREF=3D"mailto:jacknospam@pebbleridge.com">mailto:jacknospam@pebbleridge.=
com</A>] </FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;Posted At: =
Saturday, October 27, 2007 10:43 AM</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;Posted To: =
microsoft.public.dotnet.languages.vb</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;Conversation: Accesing form controls from another =
class than the one tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;created =
them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;Subject: =
Re: Accesing form controls from another class than the one =
tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;created =
them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;You don't =
show how the variable frmCall in form2 gets set.&nbsp; How =
does</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;form1 pass =
a reference to itself to form2?</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;On Sat, 27 =
Oct 2007 01:56:55 -0400, &quot;Mike&quot; &lt;mike@hitnext.com&gt; =
wrote:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Form 1 =
(frmCall)</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Public =
Property TextboxWTN() As String</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; Return Me.txtWTN.Text</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End =
Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Set(ByVal value As String)</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; Me.txtWTN.Text =3D value</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End =
Set</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;End =
Property</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Form =
2</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;frmCall.TextboxWTN =3D =
&quot;Something&quot;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;This =
is all I have</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;Thanks</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;-----Original Message-----</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;From: =
rowe_newsgroups [<A =
HREF=3D"mailto:rowe_email@yahoo.com">mailto:rowe_email@yahoo.com</A>] =
</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Posted =
At: Friday, October 26, 2007 6:36 AM</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Posted =
To: microsoft.public.dotnet.languages.vb</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;Conversation: Accesing form controls from =
another class than the one</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;created them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;Subject: Re: Accesing form controls from =
another class than the one tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;created them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;On Oct =
25, 11:06 pm, &quot;Mike&quot; &lt;m...@hitnext.com&gt; =
wrote:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
This is the property definition:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
Public Property TextboxWTN() As String</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return Me.txtWTN.Text</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; End Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; Set(ByVal value As String)</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.txtWTN.Text =3D value</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; End Set</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; End =
Property</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
And from the other form I call frmMain.TextboxWTN =3D =
&quot;Whatever&quot;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
It has no effect over the form's textbox.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
Thanks</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
-----Original Message-----</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
From: Jack Jackson [<A =
HREF=3D"mailto:jacknos...@pebbleridge.com">mailto:jacknos...@pebbleridge.=
com</A>]</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
Posted At: Thursday, October 25, 2007 9:52 PM</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
Posted To: microsoft.public.dotnet.languages.vb</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
Conversation: Accesing form controls from another class than the =
one</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
created them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
Subject: Re: Accesing form controls from another class than the =
one</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
created them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
It is the first, where frmMain is a reference to the existing =
first</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
form that you somehow passed into the second form.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
The second piece of code creates a new instance of your form, =
not</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
something that you want to do.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
By the way, saying &quot;none of them seem to work&quot; without giving =
any</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
details is not very useful.&nbsp; Error message?&nbsp; No error but had =
no</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
effect?&nbsp; Had an effect you did not want?</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
What does the property definition in form1 look like?</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
On Thu, 25 Oct 2007 14:43:54 -0400, &quot;Mike&quot; =
&lt;m...@hitnext.com&gt; wrote:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Ok, I did, buy from the 2nd form, how do I reference the =
forms'</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;property?</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Is it a direct call, like:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;frmMain.Myproperty =3D MyValue</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;or</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Dim frm As new frmMain</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;With frmMain</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp;&nbsp;&nbsp; .MyProperty =3D MyValue</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;End With</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;I have tried both an none of them seem to work.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Thanks!</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;-----Original Message-----</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;From: rowe_newsgroups [<A =
HREF=3D"mailto:rowe_em...@yahoo.com">mailto:rowe_em...@yahoo.com</A>]</FO=
NT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Posted At: Thursday, October 25, 2007 2:01 PM</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Posted To: microsoft.public.dotnet.languages.vb</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Conversation: Accesing form controls from another class than the =
one</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;created them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Subject: Re: Accesing form controls from another class than the =
one</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;tha</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;created them</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;On Oct 25, 11:34 am, &quot;Mike&quot; &lt;m...@hitnext.com&gt; =
wrote:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; Hi,</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; I have a form with some controls, and a different class that =
needs</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;to</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; modify some control properties at run time.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; Hoy can I reference the from so I have access to its controls =
and</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; therefore being able to modify its =
properties?</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; Regards,</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&gt; Mike</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;My personal preference is to keep the Controls private, and =
only</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;expose the necessary functionality via properties. This prevents =
an</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;outside object from being able to modify more than you want to =
have</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;modified.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;For example, if you want a second form to be able to modify =
a</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;label's</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;text property expose it like this:</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;////////////</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Public Property MyLabelText() As String</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp; Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp;&nbsp;&nbsp; Return MyLabel.Text</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp; End Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp; Set (ByVal value As String)</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp;&nbsp;&nbsp; MyLabel.Text =3D value</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;&nbsp; End Get</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;End Property</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;///////////</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;If instead you gave them a complete reference to the label, =
nothing</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;would stop them from calling form.MyLabel.Dispose() or =
something</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;else</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;you didn't intend. In other words, using a property =
maintains</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;encapsulation.</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Thanks,</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;&gt; =
&gt;Seth Rowe</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Are =
you sure you have a reference to the other form? If =
you</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;instantiate an new &quot;frmMain&quot; like =
you did in a previous example, you</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;will =
not be accomplishing anything. Perhaps you could post the =
code</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;where =
you are retrieving the reference to frmMain?</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;Thanks,</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT =
FACE=3D"Consolas">&gt;&gt;</FONT></SPAN></P>

<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT FACE=3D"Consolas">&gt;&gt;Seth =
Rowe</FONT></SPAN></P>

</BODY>
</HTML>
------=_NextPart_000_003E_01C81D55.246ABDE0--