简体   繁体   English

如何检查列表框是否已连接到数据源?

[英]How can i check if listbox is connected to a datasource?

theres a way to check if listbox is connected to datascource ? 有没有办法检查列表框是否已连接到datascource?

I mean something like that 我的意思是这样的

if (listbox1.datascource.enabled == true)
....

Yes just test for 是的,只是测试

if (listbox1.DataSource != null)

This could be easily discovered looking at the reference material for everything NET related 查看与NET相关的所有内容的参考资料,就很容易发现这一点。

MSDN on Listbox.DataSource Listbox.DataSource上的MSDN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何刷新列表框的数据源 - How to refresh DataSource of a ListBox 在C#中设置listBox的数据源时,如何避免NullReferenceException? - How can I avoid NullReferenceException when setting the DataSource of a listBox in C#? 如何检查值是否已存在于 ListBox 中? - How can I check if a value already exists in a ListBox? 如何检查打印机是否已物理连接到PC? - How can I check if a printer is physically connected into my PC? 如何检查我是否已连接? - How to check if I'm connected? 我有一个列表框和复选框,如何找到WPF中选中的复选框数量 - i have a listbox and check box and how can i find the how much check box checked in wpf 如何更新绑定到数据源的列表框 - How to update a listbox that is bound to a datasource 对于使用“ DataGridView”的Windows窗体应用程序,如何检查数据源中的值并更改单独单元格的颜色? - For a Windows Forms Application using `DataGridView`, how can I check a value in my DataSource and change the color of a separate cell? 更新时,如何检查listBox中的项目是否已经存在? - How can i check if items in the listBox already exist when i update it? WPF 中 DataSource 和 DisplayMember 的替代品,因此我可以在 ListBox 内显示 SQLite 数据库内容 - Alternatives for DataSource and DisplayMember in WPF so I can display SQLite database content inside a ListBox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM