Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all!!!

I have 12 text-boxes for entering Rate-Of-Intrest for different months.
Now what i need to do is if users enter rateOfIntrest in january and in august then
the properties obj. February to obj.July should get data that of Obj.January and after that that of obj.August.If data for only January is entered then all the properties will be get data that of January. Now user can enter RateOfIntrest for as many months that it wants. Please guide me how will it be done...
Posted
Comments
[no name] 10-Jul-12 9:05am    
Seems relatively simple. Have you tried to do your homework yourself? What have you tried?
Sandeep Mewara 10-Jul-12 10:54am    
See the answer below, you will be have your day made! :)
[no name] 10-Jul-12 10:58am    
I just knew that that would come up. Posting answers just to build reputation means a lot to some people I guess.
ujjwal uniyal 11-Jul-12 0:52am    
i was thinking of using foreach for finding the controls and then finding the values entered in the controls(if there are any ). Then after it i don't have an idea(logic) how to assign values to the properties. the answer below don't seem to be a good programming practice. Perhaps u can give me a hint how it should be done..

1 solution

in this case when first text box value can given by the user then bellow method can help u.

C#
TextBox1.Text ="10";
if (TextBox2.Text == "")
{
    TextBox2.Text = TextBox1.Text;
}
if (TextBox3.Text == "")
{
    TextBox3.Text = TextBox2.Text;
}
if (TextBox4.Text == "")
{
    TextBox4.Text = TextBox3.Text;
}
if (TextBox5.Text == "")
{
    TextBox5.Text = TextBox4.Text;
}
if (TextBox6.Text == "")
{
    TextBox6.Text = TextBox5.Text;
}
if (TextBox7.Text == "")
{
    TextBox7.Text = TextBox6.Text;
}
if (TextBox8.Text == "")
{
    TextBox8.Text = TextBox7.Text;
}
if (TextBox9.Text == "")
{
    TextBox9.Text = TextBox8.Text;
}
if (TextBox10.Text == "")
{
    TextBox10.Text = TextBox9.Text;
}
if (TextBox11.Text == "")
{
    TextBox11.Text = TextBox10.Text;
}
if (TextBox12.Text == "")
{
    TextBox12.Text = TextBox11.Text;
}


if TextBox3 text can change then it now consider TextBox3 values..
 
Share this answer
 
v2

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