By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,931 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,931 IT Pros & Developers. It's quick & easy.

[URGENT] VB.NET : TabControl, TabPages and UserControl Communication

P: n/a
Hi,

I'm beginner with VB.net and i have a trouble... At work, they decided
to program with tabcontrol...and i'mm in charge of this !

There is my problem.
I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages
( TBP1,2,3,..,n)
For each TBPn i 've got an specific usercontrol which have controls
and code ( data access, ... ).
I want to establish dialog between the different TBP starting from any
usercontrol.

For example :

TBP1 = UserControl1 (UC1) with ComboBox and CommandButton
TBP2 = UserControl2 (UC2) with textBox, checkBox, ComboBox and
CommandButton

When I choose an item in the ComboBox of UC1, i Click on CommandButton
to fill controls of UC2.
Finally i want to show TBP2.

I hope it was clear, cos' i'm not speaking english very well, but i
understand quiet well!
Briefly my question is :
How can two USercontrols of different tabpages communicate ?

Thnks for your answers

Best Regards From Paris

Mail_taf
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
You can use property's,

for example at uc1 (user control1) you can have a property and a variable:

Private strCode
Public Property code()
Get
return strCode 'can also be textbox.text or whatever you want, but I'd
advice to return 'variables
End Get
Set(ByVal Value)
strCode = value
End Set
End Property

and at uc2 you also have a property named code

Private strCode
Public Property code()
Get
return strCode
End Get
Set(ByVal Value)
strCode = value
End Set
End Property

than on the form where the user controls are on you can do:

uc2.code = uc1.code
hth

Peter

"ChrisK" <ma******@yahoo.fr> wrote in message
news:a1**************************@posting.google.c om...
Hi,

I'm beginner with VB.net and i have a trouble... At work, they decided
to program with tabcontrol...and i'mm in charge of this !

There is my problem.
I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages
( TBP1,2,3,..,n)
For each TBPn i 've got an specific usercontrol which have controls
and code ( data access, ... ).
I want to establish dialog between the different TBP starting from any
usercontrol.

For example :

TBP1 = UserControl1 (UC1) with ComboBox and CommandButton
TBP2 = UserControl2 (UC2) with textBox, checkBox, ComboBox and
CommandButton

When I choose an item in the ComboBox of UC1, i Click on CommandButton
to fill controls of UC2.
Finally i want to show TBP2.

I hope it was clear, cos' i'm not speaking english very well, but i
understand quiet well!
Briefly my question is :
How can two USercontrols of different tabpages communicate ?

Thnks for your answers

Best Regards From Paris

Mail_taf

Nov 21 '05 #2

P: n/a
Hi Chris,

I thought that I answered this as well in the general group.

You place normally your usercontrols globaly (friend) on your form,
therefore they can "talk" to each other everywhere in that class.

Therefore the only thing in my opinion that you have to do is as I as well
said in the general newsgroup is to select the right tabpage. indexof which
is a number from 0 to your last page or the tabcontrol.

http://msdn.microsoft.com/library/de...edtabtopic.asp

However the question seems something else so where do I not understand you?

Cor

"ChrisK" <ma******@yahoo.fr>
..
Hi,

I'm beginner with VB.net and i have a trouble... At work, they decided
to program with tabcontrol...and i'mm in charge of this !

There is my problem.
I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages
( TBP1,2,3,..,n)
For each TBPn i 've got an specific usercontrol which have controls
and code ( data access, ... ).
I want to establish dialog between the different TBP starting from any
usercontrol.

For example :

TBP1 = UserControl1 (UC1) with ComboBox and CommandButton
TBP2 = UserControl2 (UC2) with textBox, checkBox, ComboBox and
CommandButton

When I choose an item in the ComboBox of UC1, i Click on CommandButton
to fill controls of UC2.
Finally i want to show TBP2.

I hope it was clear, cos' i'm not speaking english very well, but i
understand quiet well!
Briefly my question is :
How can two USercontrols of different tabpages communicate ?

Thnks for your answers

Best Regards From Paris

Mail_taf

Nov 21 '05 #3

P: n/a
"Cor Ligthert" <no************@planet.nl> schrieb:
I thought that I answered this as well in the general group.

You place normally your usercontrols globaly (friend) on your form,
therefore they can "talk" to each other everywhere in that class.


The fact that the instances can talk to each other doesn't have much to do
with their modifier. I suggest to set the usercontrol's modifier to
'Protected' (or 'Private'). Notice that this still won't prevent the
usercontrols from communicating.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

P: n/a
Hi Cor,

I think he just want's to get some values from one usercontrol to an other
usercontrol

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
Hi Chris,

I thought that I answered this as well in the general group.

You place normally your usercontrols globaly (friend) on your form,
therefore they can "talk" to each other everywhere in that class.

Therefore the only thing in my opinion that you have to do is as I as well
said in the general newsgroup is to select the right tabpage. indexof which is a number from 0 to your last page or the tabcontrol.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformstabcontrolclassselectedtabt opic.asp
However the question seems something else so where do I not understand you?
Cor

"ChrisK" <ma******@yahoo.fr>
.
Hi,

I'm beginner with VB.net and i have a trouble... At work, they decided
to program with tabcontrol...and i'mm in charge of this !

There is my problem.
I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages
( TBP1,2,3,..,n)
For each TBPn i 've got an specific usercontrol which have controls
and code ( data access, ... ).
I want to establish dialog between the different TBP starting from any
usercontrol.

For example :

TBP1 = UserControl1 (UC1) with ComboBox and CommandButton
TBP2 = UserControl2 (UC2) with textBox, checkBox, ComboBox and
CommandButton

When I choose an item in the ComboBox of UC1, i Click on CommandButton
to fill controls of UC2.
Finally i want to show TBP2.

I hope it was clear, cos' i'm not speaking english very well, but i
understand quiet well!
Briefly my question is :
How can two USercontrols of different tabpages communicate ?

Thnks for your answers

Best Regards From Paris

Mail_taf


Nov 21 '05 #5

P: n/a
Herfried,

I can be wrong, however I thought that when you drag them on your form they
are automaticly set to Friend, that was what I tried to tell.

I see personally not much reasons to change that, however maybe you do not
mean that?

Cor

"Herfried K. Wagner [MVP]"
...
"Cor Ligthert" <no************@planet.nl> schrieb:
I thought that I answered this as well in the general group.

You place normally your usercontrols globaly (friend) on your form,
therefore they can "talk" to each other everywhere in that class.


The fact that the instances can talk to each other doesn't have much to do
with their modifier. I suggest to set the usercontrol's modifier to
'Protected' (or 'Private'). Notice that this still won't prevent the
usercontrols from communicating.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #6

P: n/a
Peter,

That is what I think as well, however that depends how he build them in my
opinion. When the properties in those controls are friend (or Public) than
that should be very easy when those usercontrols are in the same form class.
However maybe I miss something,

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
Hi Cor,

I think he just want's to get some values from one usercontrol to an other
usercontrol

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
Hi Chris,

I thought that I answered this as well in the general group.

You place normally your usercontrols globaly (friend) on your form,
therefore they can "talk" to each other everywhere in that class.

Therefore the only thing in my opinion that you have to do is as I as
well
said in the general newsgroup is to select the right tabpage. indexof

which
is a number from 0 to your last page or the tabcontrol.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformstabcontrolclassselectedtabt opic.asp

However the question seems something else so where do I not understand

you?

Cor

"ChrisK" <ma******@yahoo.fr>
.
> Hi,
>
> I'm beginner with VB.net and i have a trouble... At work, they decided
> to program with tabcontrol...and i'mm in charge of this !
>
> There is my problem.
> I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages
> ( TBP1,2,3,..,n)
> For each TBPn i 've got an specific usercontrol which have controls
> and code ( data access, ... ).
> I want to establish dialog between the different TBP starting from any
> usercontrol.
>
> For example :
>
> TBP1 = UserControl1 (UC1) with ComboBox and CommandButton
> TBP2 = UserControl2 (UC2) with textBox, checkBox, ComboBox and
> CommandButton
>
> When I choose an item in the ComboBox of UC1, i Click on CommandButton
> to fill controls of UC2.
> Finally i want to show TBP2.
>
> I hope it was clear, cos' i'm not speaking english very well, but i
> understand quiet well!
> Briefly my question is :
> How can two USercontrols of different tabpages communicate ?
>
> Thnks for your answers
>
> Best Regards From Paris
>
> Mail_taf



Nov 21 '05 #7

P: n/a
"Cor Ligthert" <no************@planet.nl> schrieb:
I can be wrong, however I thought that when you drag them on your form
they are automaticly set to Friend, that was what I tried to tell.
ACK.
I see personally not much reasons to change that, however maybe you do not
mean that?


Well, that's personal preference... I don't want to see the controls in
IntelliSense when I work on a variable holding a form's instance.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #8

P: n/a
Cor,

I don't think you're missing something because I understood the question in
the same way, or maybe we're both missing something ;-)

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:u6**************@TK2MSFTNGP14.phx.gbl...
Peter,

That is what I think as well, however that depends how he build them in my
opinion. When the properties in those controls are friend (or Public) than
that should be very easy when those usercontrols are in the same form class. However maybe I miss something,

Cor
"Peter Proost" <pp*****@nospam.hotmail.com>
Hi Cor,

I think he just want's to get some values from one usercontrol to an other usercontrol

Peter

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
Hi Chris,

I thought that I answered this as well in the general group.

You place normally your usercontrols globaly (friend) on your form,
therefore they can "talk" to each other everywhere in that class.

Therefore the only thing in my opinion that you have to do is as I as
well
said in the general newsgroup is to select the right tabpage. indexof

which
is a number from 0 to your last page or the tabcontrol.

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemwindowsformstabcontrolclassselectedtabt opic.asp

However the question seems something else so where do I not understand

you?

Cor

"ChrisK" <ma******@yahoo.fr>
.
> Hi,
>
> I'm beginner with VB.net and i have a trouble... At work, they decided > to program with tabcontrol...and i'mm in charge of this !
>
> There is my problem.
> I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages > ( TBP1,2,3,..,n)
> For each TBPn i 've got an specific usercontrol which have controls
> and code ( data access, ... ).
> I want to establish dialog between the different TBP starting from any > usercontrol.
>
> For example :
>
> TBP1 = UserControl1 (UC1) with ComboBox and CommandButton
> TBP2 = UserControl2 (UC2) with textBox, checkBox, ComboBox and
> CommandButton
>
> When I choose an item in the ComboBox of UC1, i Click on CommandButton > to fill controls of UC2.
> Finally i want to show TBP2.
>
> I hope it was clear, cos' i'm not speaking english very well, but i
> understand quiet well!
> Briefly my question is :
> How can two USercontrols of different tabpages communicate ?
>
> Thnks for your answers
>
> Best Regards From Paris
>
> Mail_taf



Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.