Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am using two user controllers in my project, each one with Models.
Now I have to change values on userController_2 if a value changes in a numUpDownBx in userController_1...

how is this to do?

thanx
Posted

1 solution

Hi,
Fine you can take a class create a get and set property in it ,
C#
class numericUpdown { public static int NumericUpDownValue{ get; set; }}


in userController in numeric updown change event you can set the property value like this
C#
numericUpdown.numericUpdownValue =numUpDownBx.value;


and now in userController_2 create a function which gets value from properity
Think that i am having a textbox1 in userController_2 and i want to get value from numericUpDown then i can write like this
C#
void getValuefromUserControl1()
{
textBox1.text= numericUpdown.numericUpdownValue.Tostring(); 
}

call
C#
getValuefromUserControl1()
in a thread
like this

C#
Thread th=new Thread(getValuefromUserControl1);
th.start();


For more information about Threading follow this link
http://www.albahari.com/threading/[^]

Threading in C#[^]


http://msdn.microsoft.com/en-us/library/aa645740%28v=vs.71%29.aspx[^]


Hope it may help you
 
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