如何使组合框可编辑 [英] How do I make combobox editable

查看:83
本文介绍了如何使组合框可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单有组合框,它读取用户输入,我想允许用户输入他自己的选择,除了下拉列表中的一次。当我运行应用程序时,我得到的异常对象引用未设置为对象的实例。



我尝试了什么:



i已经设定以下属性

AutoCompleteCustomSource到集合

AutoCompleteMode到SuggestAppend

AutoCompleteSource到CustomSource

解决方案

对象引用未设置为对象的实例。



然后,您需要使用调试器找出原因和原因。任何人都不可能猜出代码中的哪个变量没有被正确初始化。


我只是通过设置combobox.Text =string name而不是使用combobox.SelectedItem来获得解决方案。的ToString()。

My form has the combobox which reads the user input , i want to allow the user to enter his own choice apart from the once in the dropdown list.When i run the application i am getting the exception object reference not set to an instance of object.

What I have tried:

i have set the following properties
AutoCompleteCustomSource to Collection
AutoCompleteMode to SuggestAppend
AutoCompleteSource to CustomSource

解决方案

object reference not set to an instance of object.

Then you need to use your debugger to find out where and why. It is impossible for anyone to guess which variable in your code is not being initialised correctly.


i got the solution just by setting combobox.Text="string name" instead of using combobox.SelectedItem.Tostring().


这篇关于如何使组合框可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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