在枚举了combox值时,在文本框中输入值 [英] Chnage the Value in a Textbox when combox value has been chnaged

查看:71
本文介绍了在枚举了combox值时,在文本框中输入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



假设我有一个文本框调用val1和combox,它有三个索引(Meter,Feet,Inches)。假如最初用户在texfield(val1)中输入值1并从组合框中选择feet。现在我无法解决的是,现在突然他只是从组合框中选择英寸,现在我希望文本框中的值以英寸(应该是12)转换。我知道如何转换它的公式:)但我不知道如何知道最后选择的值是什么,或者可能是某人可以指导我如何解决这个问题。



非常感谢



reagrds

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

推荐答案

只需这样创建表单级变量

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



现在在combox的选择值更改中


now in combox's selection value change

cmbbox1_selectedValueChange(...)
{
	ConvertFrom = FormLevelcmbbox1LastValue ;
	ConvertTo = cmbbox1.selectedValue ;
	//write stuff to change value of textbox
	//set FormLevelcmbbox1LastValue
	FormLevelcmbbox1LastValue = cmbbox1.selectedValue ;
}



快乐编码!

:)


Happy Coding!
:)


使用状态输入你的最后一个值管理...通过以下链接,这将帮助您了解仪表,英尺,英寸和使用国家管理的概念

distance-feet-inches-class-or-struct [ ^ ]

升C-功能对转换 - 文本输入的英尺英寸米,厘米-millime [ ^ ]



ASP.NET中的状态管理 - 简介 [ ^ ]

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


这篇关于在枚举了combox值时,在文本框中输入值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆