将Text属性设置为空字符串将SelectedIndex设置为

将Text属性设置为空字符串将SelectedIndex设置为

本文介绍了将Text属性设置为空字符串将SelectedIndex设置为-1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我让使用修改组合框的文本,然后用新文本替换所选的 项目(在Keyup事件中)。 但是如果他将Text属性设置为空字符串(")将 SelectedIndex设置为-1。 你有什么建议吗?绕过这个问题? 谢谢I let the use modify the text of a combobox and then I replace the selecteditem with the new text (in Keyup event).But if he sets the Text property to an empty string ("") that sets theSelectedIndex to -1.Do you have any suggestion for getting around this problem?Thanks推荐答案 DropDownStyle是DropDown AutoCompleteMode是无 我需要知道选择了哪个项目当用户更改文本框时,我可以用我的用户输入替换所选条目的文本。但是 如果在他打字的时候他清除了selectedIndex改为-1的方框。我不知道为什么他们改变了SelectedIndex,因为文本框已经改变了。你能吗? 文本框是否以某种方式驱动选择?我知道选择可以填写 文本框但是可以更改文本框更改SelectionIndex吗? 我尝试保存SelectedIndex并重置它但我想这可能会导致 副作用,例如举起的活动。 谢谢DropDownStyle is DropDownAutoCompleteMode is NoneI need to know which item is selected when the user changes the text box sothat I can then replaced the selected entry''s text with the user input. Butif while he is typing he clears the box the selectedIndex changes to -1. Ican''t figure why they change the SelectedIndex because the text box haschanged. Can you?Does the textbox drive the selection in some way? I know selecting can fillthe textbox but can changing text box change the SelectionIndex?I tried saving SelectedIndex and resetting it but I think that may causeside effects such as raised events.Thanks 这篇关于将Text属性设置为空字符串将SelectedIndex设置为-1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 20:20