Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Uc2:
Public void Uc2_Load(...)
{
if(id==1)
{
message.show("id no is one");
}
else if(id==2)
{
message.show("id no is two");
}
else if(id==3)
{
message.show("id no is three");
}
}

Uc1:
Public void Uc1_clicked(...)
{

id=Generatingids();
}

Hai friends........
I have two user controls Uc1 and Uc2. If i click the Uc1 it generate the id Number.Now i want to pass this id no to Uc2 and display the message.....
Plz help me
Posted

1 solution

It's pretty simple - the complication is that the two UC's shouldn't know about the existence of the other. So what you do is have UC1 create an event which is handled by the parent control or form, and which collects the ID and passes it to the instance of UC2.

Yes, it sound complex, but it's really easy in practice! See here: Transferring information between two forms, Part 3: Child to Child[^] - it talks about forms, but it's exactly the same process (a Form is just a special case of a Control, after all).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900