Winforms combobox.FindStringExact can';找不到字符串

Winforms combobox.FindStringExact can';找不到字符串,winforms,vb.net-2010,Winforms,Vb.net 2010,我真的试图弄明白为什么FindStringExact方法在列表中找不到字符串 这是我的密码: If comboBox.FindStringExact(ds.Tables(0).Rows(0).Item(1).ToString) > 0 Then comboBox.SelectedIndex = comboBox.FindStringExact(ds.Tables(0).Rows(0).Item(1).ToString) End If 出现问题的字符串是“000个字符”和“000个字

我真的试图弄明白为什么FindStringExact方法在列表中找不到字符串

这是我的密码:

If comboBox.FindStringExact(ds.Tables(0).Rows(0).Item(1).ToString) > 0 Then
   comboBox.SelectedIndex = comboBox.FindStringExact(ds.Tables(0).Rows(0).Item(1).ToString)
End If
出现问题的字符串是“000个字符”和“000个字符和字符”,我已经检查了是否有多余的空格,表中的值也是正确的。我想这和左边的零和中间的符号有关


所有帮助都将不胜感激。

如果找到搜索值,Findstringexact将返回索引号

Dim n as Integer = comboBox.FindStringExact(ds.Tables(0).Rows(0).Item(1).ToString)

If n > -1 Then
   comboBox.SelectedIndex = n
End If

这个公式是针对datagrid的,数值单元格查看您的示例使我意识到索引值从0开始,我搜索的值在组合框中有索引0。我只是按照建议将值更改为-1。非常感谢。