Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 将组合框中的第一个字段设置为null_Vb.net_Winforms_Combobox_Selectedindex - Fatal编程技术网

Vb.net 将组合框中的第一个字段设置为null

Vb.net 将组合框中的第一个字段设置为null,vb.net,winforms,combobox,selectedindex,Vb.net,Winforms,Combobox,Selectedindex,我的表格上有一个数据绑定的组合框。有没有办法把第一个字段改为空白 我可以在.Net的HTML部分使用DropDownList来实现这一点,但是有没有一种方法可以在组合框中实现呢 谢谢您可以在数据源中插入一个空白条目 Public Class Data Public Property No() As Integer Public Property Name() As String End Class 和(数据)清单 您可以在数据源中插入空白条目 Public Class Data Publ

我的表格上有一个数据绑定的组合框。有没有办法把第一个字段改为空白

我可以在.Net的HTML部分使用DropDownList来实现这一点,但是有没有一种方法可以在组合框中实现呢


谢谢

您可以在数据源中插入一个空白条目

Public Class Data
 Public Property No() As Integer
 Public Property Name() As String
End Class
和(数据)清单


您可以在数据源中插入空白条目

Public Class Data
 Public Property No() As Integer
 Public Property Name() As String
End Class
和(数据)清单


这是我用来解决这个问题的代码


ComboBox1.SelectedValue=-1

这是我用来解决这个问题的代码

ComboBox1.SelectedValue = -1 
ComboBox1.SelectedValue=-1

ComboBox1.SelectedValue = -1 
这对我不起作用,但它确实起了作用:

ComboBox1.SelectedIndex = -1 
我认为-1是无效的索引值,但显然不是

克里斯蒂安

这对我不起作用,但它确实起了作用:

ComboBox1.SelectedIndex = -1 
我认为-1是无效的索引值,但显然不是


克里斯蒂安

我做的是ComboBox1.SelectedValue=-1@AVD事实上,你的答案就是回答他的问题的答案,问题是他把他的问题框错了我所做的是ComboBox1.SelectedValue=-1@AVD事实上,你的答案就是回答他的问题的答案,问题是他把他的问题框错了