Home All Groups Group Topic Archive Search About

Expose Form Properties and it Controls Properties.

Author
15 Jun 2006 5:43 PM
Dimsion
Hi,

How do i expose all my forms and it controls to other form in the project?
I want to be able to add a form and some control on it, this then be
available to all other forms.

form1 click event:
    'this allow me to change the textbox on form2 from form1
    Form2.text=""
    'this allow me to add item to form2 from form1
    Form2.listview.item.add("")
end form1 click event:

Dimsion
Visual Studio 2005/VB

====Sorry to double post this, but maybe where i have posted this quesiton
was not the right place the first time.===

Author
15 Jun 2006 7:18 PM
IdleBrain
Hello:

Declare a instance of form 2 in form1 and use that instance to refer to
form2's controls.
Like:
Dim instfrm2 as New form2
instfrm2.text = ""
instfrm2.listview.item.add("")

You might even declare a public variable for form2 and access it within
form1.

Hope this helps
Author
15 Jun 2006 8:19 PM
Ahmed
I believe all forms are public by default and all controls are Friends
by default unless you change the modifiers property of that control to
something else. Friends modifier means, other classes/forms within the
same project/assembly are permitted to change the properties and adding
items to the control. Let's go back to your example:

you have form1 that has a click capture a click event
Form2 has a textbox and a listview controls
Now, when the click event is fired:
Form2.textbox.text = "Whatever" and Form2.listview.item.add("Whatever")
are excuted and they shouldn't cause any problems.

I am assuming that both forms are running on the same thread. If each
as its own thread, you need to use delegates or p/invoke. Somebody
correct me if I am wrong.

Ahmed


Dimsion wrote:
Show quoteHide quote
> Hi,
>
> How do i expose all my forms and it controls to other form in the project?
> I want to be able to add a form and some control on it, this then be
> available to all other forms.
>
> form1 click event:
>     'this allow me to change the textbox on form2 from form1
>     Form2.text=""
>     'this allow me to add item to form2 from form1
>     Form2.listview.item.add("")
> end form1 click event:
>
> Dimsion
> Visual Studio 2005/VB
>
> ====Sorry to double post this, but maybe where i have posted this quesiton
> was not the right place the first time.===
Author
15 Jun 2006 8:48 PM
Dimsion
Ahmed,

I have two project that i work on, the old one can communicate between forms
and controls. If i added a new form and control on it to that project it can
continue to allow me to access the form and controls. However if i start a
new proect, it will not work the same way.

I have try to declare as IdelBrain mention in the other thread, but it only
allow me access to the form and not it controls.

Thanks,
Dimsion


Show quoteHide quote
"Ahmed" <ahmed1***@gmail.com> wrote in message
news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
>I believe all forms are public by default and all controls are Friends
> by default unless you change the modifiers property of that control to
> something else. Friends modifier means, other classes/forms within the
> same project/assembly are permitted to change the properties and adding
> items to the control. Let's go back to your example:
>
> you have form1 that has a click capture a click event
> Form2 has a textbox and a listview controls
> Now, when the click event is fired:
> Form2.textbox.text = "Whatever" and Form2.listview.item.add("Whatever")
> are excuted and they shouldn't cause any problems.
>
> I am assuming that both forms are running on the same thread. If each
> as its own thread, you need to use delegates or p/invoke. Somebody
> correct me if I am wrong.
>
> Ahmed
>
>
> Dimsion wrote:
>> Hi,
>>
>> How do i expose all my forms and it controls to other form in the
>> project?
>> I want to be able to add a form and some control on it, this then be
>> available to all other forms.
>>
>> form1 click event:
>>     'this allow me to change the textbox on form2 from form1
>>     Form2.text=""
>>     'this allow me to add item to form2 from form1
>>     Form2.listview.item.add("")
>> end form1 click event:
>>
>> Dimsion
>> Visual Studio 2005/VB
>>
>> ====Sorry to double post this, but maybe where i have posted this
>> quesiton
>> was not the right place the first time.===
>
Author
15 Jun 2006 9:03 PM
Ahmed
It didn't allow you to access them because their modifier is set to
Friends which is the default value. If you select and of the controls
(listview, buttons), in the properties window there is an entry called
modifers. You need to set that to public. But, that means anybody who
knows .NET can include your excutable in their project and have fun
with it.

Dimsion wrote:
Show quoteHide quote
> Ahmed,
>
> I have two project that i work on, the old one can communicate between forms
> and controls. If i added a new form and control on it to that project it can
> continue to allow me to access the form and controls. However if i start a
> new proect, it will not work the same way.
>
> I have try to declare as IdelBrain mention in the other thread, but it only
> allow me access to the form and not it controls.
>
> Thanks,
> Dimsion
>
>
> "Ahmed" <ahmed1***@gmail.com> wrote in message
> news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
> >I believe all forms are public by default and all controls are Friends
> > by default unless you change the modifiers property of that control to
> > something else. Friends modifier means, other classes/forms within the
> > same project/assembly are permitted to change the properties and adding
> > items to the control. Let's go back to your example:
> >
> > you have form1 that has a click capture a click event
> > Form2 has a textbox and a listview controls
> > Now, when the click event is fired:
> > Form2.textbox.text = "Whatever" and Form2.listview.item.add("Whatever")
> > are excuted and they shouldn't cause any problems.
> >
> > I am assuming that both forms are running on the same thread. If each
> > as its own thread, you need to use delegates or p/invoke. Somebody
> > correct me if I am wrong.
> >
> > Ahmed
> >
> >
> > Dimsion wrote:
> >> Hi,
> >>
> >> How do i expose all my forms and it controls to other form in the
> >> project?
> >> I want to be able to add a form and some control on it, this then be
> >> available to all other forms.
> >>
> >> form1 click event:
> >>     'this allow me to change the textbox on form2 from form1
> >>     Form2.text=""
> >>     'this allow me to add item to form2 from form1
> >>     Form2.listview.item.add("")
> >> end form1 click event:
> >>
> >> Dimsion
> >> Visual Studio 2005/VB
> >>
> >> ====Sorry to double post this, but maybe where i have posted this
> >> quesiton
> >> was not the right place the first time.===
> >
Author
15 Jun 2006 9:20 PM
Dimsion
Thanks Ahmed,

The project default was private, that's why i can't get it to work.
I have change it to friend and everything work fine. I think friend would
only allow the program  access the properties and not everyone else(i
think..).

Thanks you sooo much!!

Dimsion.

Show quoteHide quote
"Ahmed" <ahmed1***@gmail.com> wrote in message
news:1150405426.771654.160030@g10g2000cwb.googlegroups.com...
> It didn't allow you to access them because their modifier is set to
> Friends which is the default value. If you select and of the controls
> (listview, buttons), in the properties window there is an entry called
> modifers. You need to set that to public. But, that means anybody who
> knows .NET can include your excutable in their project and have fun
> with it.
>
> Dimsion wrote:
>> Ahmed,
>>
>> I have two project that i work on, the old one can communicate between
>> forms
>> and controls. If i added a new form and control on it to that project it
>> can
>> continue to allow me to access the form and controls. However if i start
>> a
>> new proect, it will not work the same way.
>>
>> I have try to declare as IdelBrain mention in the other thread, but it
>> only
>> allow me access to the form and not it controls.
>>
>> Thanks,
>> Dimsion
>>
>>
>> "Ahmed" <ahmed1***@gmail.com> wrote in message
>> news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
>> >I believe all forms are public by default and all controls are Friends
>> > by default unless you change the modifiers property of that control to
>> > something else. Friends modifier means, other classes/forms within the
>> > same project/assembly are permitted to change the properties and adding
>> > items to the control. Let's go back to your example:
>> >
>> > you have form1 that has a click capture a click event
>> > Form2 has a textbox and a listview controls
>> > Now, when the click event is fired:
>> > Form2.textbox.text = "Whatever" and Form2.listview.item.add("Whatever")
>> > are excuted and they shouldn't cause any problems.
>> >
>> > I am assuming that both forms are running on the same thread. If each
>> > as its own thread, you need to use delegates or p/invoke. Somebody
>> > correct me if I am wrong.
>> >
>> > Ahmed
>> >
>> >
>> > Dimsion wrote:
>> >> Hi,
>> >>
>> >> How do i expose all my forms and it controls to other form in the
>> >> project?
>> >> I want to be able to add a form and some control on it, this then be
>> >> available to all other forms.
>> >>
>> >> form1 click event:
>> >>     'this allow me to change the textbox on form2 from form1
>> >>     Form2.text=""
>> >>     'this allow me to add item to form2 from form1
>> >>     Form2.listview.item.add("")
>> >> end form1 click event:
>> >>
>> >> Dimsion
>> >> Visual Studio 2005/VB
>> >>
>> >> ====Sorry to double post this, but maybe where i have posted this
>> >> quesiton
>> >> was not the right place the first time.===
>> >
>
Author
16 Jun 2006 6:12 PM
Dimsion
Ahmed,

Do you know how to set the default to be friend instead of private?

Thanks,
Dimsion

Show quoteHide quote
"Dimsion" <dims***@hotmail.com> wrote in message
news:%23bJ0IGMkGHA.4104@TK2MSFTNGP04.phx.gbl...
> Thanks Ahmed,
>
> The project default was private, that's why i can't get it to work.
> I have change it to friend and everything work fine. I think friend would
> only allow the program  access the properties and not everyone else(i
> think..).
>
> Thanks you sooo much!!
>
> Dimsion.
>
> "Ahmed" <ahmed1***@gmail.com> wrote in message
> news:1150405426.771654.160030@g10g2000cwb.googlegroups.com...
>> It didn't allow you to access them because their modifier is set to
>> Friends which is the default value. If you select and of the controls
>> (listview, buttons), in the properties window there is an entry called
>> modifers. You need to set that to public. But, that means anybody who
>> knows .NET can include your excutable in their project and have fun
>> with it.
>>
>> Dimsion wrote:
>>> Ahmed,
>>>
>>> I have two project that i work on, the old one can communicate between
>>> forms
>>> and controls. If i added a new form and control on it to that project it
>>> can
>>> continue to allow me to access the form and controls. However if i start
>>> a
>>> new proect, it will not work the same way.
>>>
>>> I have try to declare as IdelBrain mention in the other thread, but it
>>> only
>>> allow me access to the form and not it controls.
>>>
>>> Thanks,
>>> Dimsion
>>>
>>>
>>> "Ahmed" <ahmed1***@gmail.com> wrote in message
>>> news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
>>> >I believe all forms are public by default and all controls are Friends
>>> > by default unless you change the modifiers property of that control to
>>> > something else. Friends modifier means, other classes/forms within the
>>> > same project/assembly are permitted to change the properties and
>>> > adding
>>> > items to the control. Let's go back to your example:
>>> >
>>> > you have form1 that has a click capture a click event
>>> > Form2 has a textbox and a listview controls
>>> > Now, when the click event is fired:
>>> > Form2.textbox.text = "Whatever" and
>>> > Form2.listview.item.add("Whatever")
>>> > are excuted and they shouldn't cause any problems.
>>> >
>>> > I am assuming that both forms are running on the same thread. If each
>>> > as its own thread, you need to use delegates or p/invoke. Somebody
>>> > correct me if I am wrong.
>>> >
>>> > Ahmed
>>> >
>>> >
>>> > Dimsion wrote:
>>> >> Hi,
>>> >>
>>> >> How do i expose all my forms and it controls to other form in the
>>> >> project?
>>> >> I want to be able to add a form and some control on it, this then be
>>> >> available to all other forms.
>>> >>
>>> >> form1 click event:
>>> >>     'this allow me to change the textbox on form2 from form1
>>> >>     Form2.text=""
>>> >>     'this allow me to add item to form2 from form1
>>> >>     Form2.listview.item.add("")
>>> >> end form1 click event:
>>> >>
>>> >> Dimsion
>>> >> Visual Studio 2005/VB
>>> >>
>>> >> ====Sorry to double post this, but maybe where i have posted this
>>> >> quesiton
>>> >> was not the right place the first time.===
>>> >
>>
>
>
Author
16 Jun 2006 6:49 PM
Ahmed
Hi Dimsion,

The set the default of what?

Let me know.
Ahmed
Dimsion wrote:
Show quoteHide quote
> Ahmed,
>
> Do you know how to set the default to be friend instead of private?
>
> Thanks,
> Dimsion
>
> "Dimsion" <dims***@hotmail.com> wrote in message
> news:%23bJ0IGMkGHA.4104@TK2MSFTNGP04.phx.gbl...
> > Thanks Ahmed,
> >
> > The project default was private, that's why i can't get it to work.
> > I have change it to friend and everything work fine. I think friend would
> > only allow the program  access the properties and not everyone else(i
> > think..).
> >
> > Thanks you sooo much!!
> >
> > Dimsion.
> >
> > "Ahmed" <ahmed1***@gmail.com> wrote in message
> > news:1150405426.771654.160030@g10g2000cwb.googlegroups.com...
> >> It didn't allow you to access them because their modifier is set to
> >> Friends which is the default value. If you select and of the controls
> >> (listview, buttons), in the properties window there is an entry called
> >> modifers. You need to set that to public. But, that means anybody who
> >> knows .NET can include your excutable in their project and have fun
> >> with it.
> >>
> >> Dimsion wrote:
> >>> Ahmed,
> >>>
> >>> I have two project that i work on, the old one can communicate between
> >>> forms
> >>> and controls. If i added a new form and control on it to that project it
> >>> can
> >>> continue to allow me to access the form and controls. However if i start
> >>> a
> >>> new proect, it will not work the same way.
> >>>
> >>> I have try to declare as IdelBrain mention in the other thread, but it
> >>> only
> >>> allow me access to the form and not it controls.
> >>>
> >>> Thanks,
> >>> Dimsion
> >>>
> >>>
> >>> "Ahmed" <ahmed1***@gmail.com> wrote in message
> >>> news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
> >>> >I believe all forms are public by default and all controls are Friends
> >>> > by default unless you change the modifiers property of that control to
> >>> > something else. Friends modifier means, other classes/forms within the
> >>> > same project/assembly are permitted to change the properties and
> >>> > adding
> >>> > items to the control. Let's go back to your example:
> >>> >
> >>> > you have form1 that has a click capture a click event
> >>> > Form2 has a textbox and a listview controls
> >>> > Now, when the click event is fired:
> >>> > Form2.textbox.text = "Whatever" and
> >>> > Form2.listview.item.add("Whatever")
> >>> > are excuted and they shouldn't cause any problems.
> >>> >
> >>> > I am assuming that both forms are running on the same thread. If each
> >>> > as its own thread, you need to use delegates or p/invoke. Somebody
> >>> > correct me if I am wrong.
> >>> >
> >>> > Ahmed
> >>> >
> >>> >
> >>> > Dimsion wrote:
> >>> >> Hi,
> >>> >>
> >>> >> How do i expose all my forms and it controls to other form in the
> >>> >> project?
> >>> >> I want to be able to add a form and some control on it, this then be
> >>> >> available to all other forms.
> >>> >>
> >>> >> form1 click event:
> >>> >>     'this allow me to change the textbox on form2 from form1
> >>> >>     Form2.text=""
> >>> >>     'this allow me to add item to form2 from form1
> >>> >>     Form2.listview.item.add("")
> >>> >> end form1 click event:
> >>> >>
> >>> >> Dimsion
> >>> >> Visual Studio 2005/VB
> >>> >>
> >>> >> ====Sorry to double post this, but maybe where i have posted this
> >>> >> quesiton
> >>> >> was not the right place the first time.===
> >>> >
> >>
> >
> >
Author
17 Jun 2006 12:07 AM
Dimsion
Sorry about that,
I meant to say do you know how to set the modifier default to friend,
currently every project i started have the modifier set to private.

Thanks again,
Dimsion
Show quoteHide quote
"Ahmed" <ahmed1***@gmail.com> wrote in message
news:1150483771.543839.317670@p79g2000cwp.googlegroups.com...
> Hi Dimsion,
>
> The set the default of what?
>
> Let me know.
> Ahmed
> Dimsion wrote:
>> Ahmed,
>>
>> Do you know how to set the default to be friend instead of private?
>>
>> Thanks,
>> Dimsion
>>
>> "Dimsion" <dims***@hotmail.com> wrote in message
>> news:%23bJ0IGMkGHA.4104@TK2MSFTNGP04.phx.gbl...
>> > Thanks Ahmed,
>> >
>> > The project default was private, that's why i can't get it to work.
>> > I have change it to friend and everything work fine. I think friend
>> > would
>> > only allow the program  access the properties and not everyone else(i
>> > think..).
>> >
>> > Thanks you sooo much!!
>> >
>> > Dimsion.
>> >
>> > "Ahmed" <ahmed1***@gmail.com> wrote in message
>> > news:1150405426.771654.160030@g10g2000cwb.googlegroups.com...
>> >> It didn't allow you to access them because their modifier is set to
>> >> Friends which is the default value. If you select and of the controls
>> >> (listview, buttons), in the properties window there is an entry called
>> >> modifers. You need to set that to public. But, that means anybody who
>> >> knows .NET can include your excutable in their project and have fun
>> >> with it.
>> >>
>> >> Dimsion wrote:
>> >>> Ahmed,
>> >>>
>> >>> I have two project that i work on, the old one can communicate
>> >>> between
>> >>> forms
>> >>> and controls. If i added a new form and control on it to that project
>> >>> it
>> >>> can
>> >>> continue to allow me to access the form and controls. However if i
>> >>> start
>> >>> a
>> >>> new proect, it will not work the same way.
>> >>>
>> >>> I have try to declare as IdelBrain mention in the other thread, but
>> >>> it
>> >>> only
>> >>> allow me access to the form and not it controls.
>> >>>
>> >>> Thanks,
>> >>> Dimsion
>> >>>
>> >>>
>> >>> "Ahmed" <ahmed1***@gmail.com> wrote in message
>> >>> news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
>> >>> >I believe all forms are public by default and all controls are
>> >>> >Friends
>> >>> > by default unless you change the modifiers property of that control
>> >>> > to
>> >>> > something else. Friends modifier means, other classes/forms within
>> >>> > the
>> >>> > same project/assembly are permitted to change the properties and
>> >>> > adding
>> >>> > items to the control. Let's go back to your example:
>> >>> >
>> >>> > you have form1 that has a click capture a click event
>> >>> > Form2 has a textbox and a listview controls
>> >>> > Now, when the click event is fired:
>> >>> > Form2.textbox.text = "Whatever" and
>> >>> > Form2.listview.item.add("Whatever")
>> >>> > are excuted and they shouldn't cause any problems.
>> >>> >
>> >>> > I am assuming that both forms are running on the same thread. If
>> >>> > each
>> >>> > as its own thread, you need to use delegates or p/invoke. Somebody
>> >>> > correct me if I am wrong.
>> >>> >
>> >>> > Ahmed
>> >>> >
>> >>> >
>> >>> > Dimsion wrote:
>> >>> >> Hi,
>> >>> >>
>> >>> >> How do i expose all my forms and it controls to other form in the
>> >>> >> project?
>> >>> >> I want to be able to add a form and some control on it, this then
>> >>> >> be
>> >>> >> available to all other forms.
>> >>> >>
>> >>> >> form1 click event:
>> >>> >>     'this allow me to change the textbox on form2 from form1
>> >>> >>     Form2.text=""
>> >>> >>     'this allow me to add item to form2 from form1
>> >>> >>     Form2.listview.item.add("")
>> >>> >> end form1 click event:
>> >>> >>
>> >>> >> Dimsion
>> >>> >> Visual Studio 2005/VB
>> >>> >>
>> >>> >> ====Sorry to double post this, but maybe where i have posted this
>> >>> >> quesiton
>> >>> >> was not the right place the first time.===
>> >>> >
>> >>
>> >
>> >
>
Author
17 Jun 2006 5:07 AM
Ahmed
But I never saw a modifer for a project. Usually the modifer for the
controls on the form. Just select all controls and set the modifer to
friend or public.

Dimsion wrote:
Show quoteHide quote
> Sorry about that,
> I meant to say do you know how to set the modifier default to friend,
> currently every project i started have the modifier set to private.
>
> Thanks again,
> Dimsion
> "Ahmed" <ahmed1***@gmail.com> wrote in message
> news:1150483771.543839.317670@p79g2000cwp.googlegroups.com...
> > Hi Dimsion,
> >
> > The set the default of what?
> >
> > Let me know.
> > Ahmed
> > Dimsion wrote:
> >> Ahmed,
> >>
> >> Do you know how to set the default to be friend instead of private?
> >>
> >> Thanks,
> >> Dimsion
> >>
> >> "Dimsion" <dims***@hotmail.com> wrote in message
> >> news:%23bJ0IGMkGHA.4104@TK2MSFTNGP04.phx.gbl...
> >> > Thanks Ahmed,
> >> >
> >> > The project default was private, that's why i can't get it to work.
> >> > I have change it to friend and everything work fine. I think friend
> >> > would
> >> > only allow the program  access the properties and not everyone else(i
> >> > think..).
> >> >
> >> > Thanks you sooo much!!
> >> >
> >> > Dimsion.
> >> >
> >> > "Ahmed" <ahmed1***@gmail.com> wrote in message
> >> > news:1150405426.771654.160030@g10g2000cwb.googlegroups.com...
> >> >> It didn't allow you to access them because their modifier is set to
> >> >> Friends which is the default value. If you select and of the controls
> >> >> (listview, buttons), in the properties window there is an entry called
> >> >> modifers. You need to set that to public. But, that means anybody who
> >> >> knows .NET can include your excutable in their project and have fun
> >> >> with it.
> >> >>
> >> >> Dimsion wrote:
> >> >>> Ahmed,
> >> >>>
> >> >>> I have two project that i work on, the old one can communicate
> >> >>> between
> >> >>> forms
> >> >>> and controls. If i added a new form and control on it to that project
> >> >>> it
> >> >>> can
> >> >>> continue to allow me to access the form and controls. However if i
> >> >>> start
> >> >>> a
> >> >>> new proect, it will not work the same way.
> >> >>>
> >> >>> I have try to declare as IdelBrain mention in the other thread, but
> >> >>> it
> >> >>> only
> >> >>> allow me access to the form and not it controls.
> >> >>>
> >> >>> Thanks,
> >> >>> Dimsion
> >> >>>
> >> >>>
> >> >>> "Ahmed" <ahmed1***@gmail.com> wrote in message
> >> >>> news:1150402769.443990.253890@g10g2000cwb.googlegroups.com...
> >> >>> >I believe all forms are public by default and all controls are
> >> >>> >Friends
> >> >>> > by default unless you change the modifiers property of that control
> >> >>> > to
> >> >>> > something else. Friends modifier means, other classes/forms within
> >> >>> > the
> >> >>> > same project/assembly are permitted to change the properties and
> >> >>> > adding
> >> >>> > items to the control. Let's go back to your example:
> >> >>> >
> >> >>> > you have form1 that has a click capture a click event
> >> >>> > Form2 has a textbox and a listview controls
> >> >>> > Now, when the click event is fired:
> >> >>> > Form2.textbox.text = "Whatever" and
> >> >>> > Form2.listview.item.add("Whatever")
> >> >>> > are excuted and they shouldn't cause any problems.
> >> >>> >
> >> >>> > I am assuming that both forms are running on the same thread. If
> >> >>> > each
> >> >>> > as its own thread, you need to use delegates or p/invoke. Somebody
> >> >>> > correct me if I am wrong.
> >> >>> >
> >> >>> > Ahmed
> >> >>> >
> >> >>> >
> >> >>> > Dimsion wrote:
> >> >>> >> Hi,
> >> >>> >>
> >> >>> >> How do i expose all my forms and it controls to other form in the
> >> >>> >> project?
> >> >>> >> I want to be able to add a form and some control on it, this then
> >> >>> >> be
> >> >>> >> available to all other forms.
> >> >>> >>
> >> >>> >> form1 click event:
> >> >>> >>     'this allow me to change the textbox on form2 from form1
> >> >>> >>     Form2.text=""
> >> >>> >>     'this allow me to add item to form2 from form1
> >> >>> >>     Form2.listview.item.add("")
> >> >>> >> end form1 click event:
> >> >>> >>
> >> >>> >> Dimsion
> >> >>> >> Visual Studio 2005/VB
> >> >>> >>
> >> >>> >> ====Sorry to double post this, but maybe where i have posted this
> >> >>> >> quesiton
> >> >>> >> was not the right place the first time.===
> >> >>> >
> >> >>
> >> >
> >> >
> >