组合框值更改事件已执行. [英] combobox value change event executed.

查看:114
本文介绍了组合框值更改事件已执行.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在组合框值更改事件上编写代码.我只想在手动更改组合框值时执行它.但是每当我写代码时cmb1.text =".在这种情况下,将执行组合框更改值事件.但是我不想要它.我希望它仅在通过单击该组合框更改组合框值时才执行.

I write a code on combobox value change event. I want to execute it only when I change my combobox value manually. But whenever I write code e.g. cmb1.text="" . At that instance the combobox change value event is executed. But I don''t want it. I want it to execute only when I change the combobox value by clicking on that combobox.

推荐答案

将Text设置为存在的值时,将触发SelectedIndexChanged事件在组合框的下拉列表部分.如果在分配空字符串时触发,则列表中必须有一个空字符串.

一个非常有用的事件是SelectionChangeCommitted,因为仅当用户更改选择时才引发此事件,而当以编程方式更改值时才引发.

SelectionChangeCommitted [
The SelectedIndexChanged event will fire when you set the Text to a value that exists in the dropdown list part of the combobox. If it is firing when you assign an empty string then there must be an empty string in the list.

A very useful event is SelectionChangeCommitted as this is raised only when the user changes the selection and not when values are changed programmatically.

SelectionChangeCommitted[^]

Alan.


这篇关于组合框值更改事件已执行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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