Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.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 使用Like函数进行搜索_Vb.net - Fatal编程技术网

Vb.net 使用Like函数进行搜索

Vb.net 使用Like函数进行搜索,vb.net,Vb.net,我正在搜索我的数据网格视图。我的搜索变量从单元格中选取数据,与搜索字符串和报告匹配。这太完美了。 我需要使它的工作,以便如果使用希望搜索说“约翰”,块包含“约翰史密斯”应该匹配。目前我不得不完全使用“约翰·史密斯” 请告诉我怎么做。我的代码如下所示 Do While vrTotalRows > vrLoopCntr vrPickFromGrid = UCase(DataGridView1.Item(0, vrLoopCntr).Value)

我正在搜索我的数据网格视图。我的搜索变量从单元格中选取数据,与搜索字符串和报告匹配。这太完美了。
我需要使它的工作,以便如果使用希望搜索说“约翰”,块包含“约翰史密斯”应该匹配。目前我不得不完全使用“约翰·史密斯”

请告诉我怎么做。我的代码如下所示

Do While vrTotalRows > vrLoopCntr
            vrPickFromGrid = UCase(DataGridView1.Item(0, vrLoopCntr).Value)
            If vrPickFromGrid = UCase(txtFind.Text) Then 'Found
                DataGridView1.Rows(vrLoopCntr).DefaultCellStyle.BackColor = Color.CornflowerBlue
            End If
            vrPickFromGridC2 = UCase(DataGridView1.Item(1, vrLoopCntr).Value)
            If vrPickFromGridC2 = UCase(txtFind.Text) Then 'Found
                DataGridView1.Rows(vrLoopCntr).DefaultCellStyle.BackColor = Color.CornflowerBlue
            End If
            vrLoopCntr = vrLoopCntr + 1
        Loop
使用
String.Contains(…)
我建议您使用

变成:

If vrPickFromGrid.Contains(UCase(txtFind.Text)) Then

Ugh-用于代码的样式上写满了vb6。您现在所做的大部分工作都是向后的。您建议如何使其成为vb.net代码?
If vrPickFromGrid.Contains(UCase(txtFind.Text)) Then