在组合框中进行选择后,我们如何制作eanble和禁用文本框 [英] how we make eanble and disable the textboxes after making selection in combobox
本文介绍了在组合框中进行选择后,我们如何制作eanble和禁用文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在组合框内进行选择时,我在启用和禁用控件方面遇到问题.
I have problem to enable and disable control while making selection in combobox.
推荐答案
使用组合框selectedindexchanged事件作为设置AutoPostback = true
根据收到的选定索引
您可以启用或禁用类似
的文本框
if(combo1.selecteditem.text =="a")
txtbox1.enabled = true;
其他
txtbox1.enabled = false;
use combobox selectedindexchanged event as set AutoPostback=true
on basis of recieved selected index
u can enable or disable textboxes like
if(combo1.selecteditem.text=="a")
txtbox1.enabled=true;
else
txtbox1.enabled=false;
使用组合框的SelectedIndexChanged事件.在这种方法中,您可以使用
Use the SelectedIndexChanged event of the combo box. In that method, you can use
TextBox.Enable = true; // to enable it
TextBox.Enable = false; // to disable it
如果要在选择过程处于活动状态时禁用文本框,则应签出:
If you mean to disable textboxes while selection process is active you should check out:
private void comboBox1_DropDown(object sender, EventArgs e)
{
//Do your stuff
}
private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
//Undo your stuff
}
这篇关于在组合框中进行选择后,我们如何制作eanble和禁用文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文