Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello

Say i have a textbox call val1 and combox that has three indexes (Meter,Feet,Inches). Say if initially user entered the value "1" in the texfield(val1) and selected "feet" from combobox. Now what i am not been able to solve is that say now suddenly he just selects inches from combobox, now i want the value in the textbox to be converted in inches(should be 12). I know the formula how to convert it :) but i donot know how to know what was the last selected value or may be if some one can guide me how this case can be solved.

Thanks anyways

reagrds
Posted
Comments
Sunasara Imdadhusen 27-Dec-13 7:00am    
Could you please share your code with us?

simply do this create form level variable
C#
int FormLevelcmbbox1LastValue  = 0;

now in combox's selection value change
C#
cmbbox1_selectedValueChange(...)
{
	ConvertFrom = FormLevelcmbbox1LastValue ;
	ConvertTo = cmbbox1.selectedValue ;
	//write stuff to change value of textbox
	//set FormLevelcmbbox1LastValue
	FormLevelcmbbox1LastValue = cmbbox1.selectedValue ;
}

Happy Coding!
:)
 
Share this answer
 
Comments
BillWoodruff 27-Dec-13 8:11am    
Good answer. Upvoted.
Aarti Meswania 27-Dec-13 8:26am    
Thank you! :) BillWoodruff
loraloper_22 27-Dec-13 8:23am    
Very Nice Solution
Aarti Meswania 27-Dec-13 8:26am    
Thanks! :) loraloper_22
Put your last value using state management...Go through following links which will help you for concept of Meter,Feet,Inches and using of Statemanagement
distance-feet-inches-class-or-struct[^]
c-sharp-function-to-convert-text-input-of-feet-inches-meters-centimeters-millime[^]

State Management in ASP.NET - Introduction[^]
http://www.dotnetfunda.com/articles/show/61/state-management-in-aspnet[^]
 
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