Private Sub filterbykeyword()
If cmbstate.Text = "" Then Exit Sub
If DataGridView3.Rows.Count = 0 Then Exit Sub
For i As Integer = 1 To DataGridView3.Rows.Count - 1
If DataGridView3.Rows(i).Cells(1).Style.BackColor = Color.White Then
For j As Integer = LBound(newcolegeprin) To UBound(newcolegeprin)
If Trim(UCase(DataGridView3.Rows(i).Cells(1).Value)) Like "*" & Trim(UCase(newcolegeprin(j))) & "*" And newcolegeprin(j) <> "" Then
If newexactmatchingdata(Trim(UCase(DataGridView3.Rows(i).Cells(1).Value)), (j + 1)) = True Then
DataGridView3.Rows(i).Cells(2).Value = "4"
DataGridView3.Rows(i).Cells(1).Style.BackColor = Color.Cyan
Exit For
Else
Exit For
End If
End If
Next
End If
Next
End Sub
=================
Function newexactmatchingdata(ByVal wrdsting As String, ByVal arrno As Integer)
newexactmatchingdata = False
Dim kkkk As Integer
Dim nn As Integer
Dim mk As Integer
Dim newwrd() As String = Split(Trim(wrdsting), " ")
kkkk = UBound(newcolegeprin)
Dim match() As Boolean
ReDim match(Val(kkkk))
Dim abc As Boolean
For mk = 0 To UBound(newcolegeprin)
If Trim(UCase(newcolegeprin(mk))) <> "" Then
For nn = 0 To UBound(newwrd)
abc = False
If Trim(UCase(newwrd(nn))) = Trim(UCase(newcolegeprin(mk))) Then
abc = True
Exit For
End If
Next
If abc = True Then
match(mk) = True
Else
match(mk) = False
End If
End If
Next
For mk = 0 To UBound(match)
If match(mk) = False Then
Exit Function
End If
Next
newexactmatchingdata = True
End Function
If cmbstate.Text = "" Then Exit Sub
If DataGridView3.Rows.Count = 0 Then Exit Sub
For i As Integer = 1 To DataGridView3.Rows.Count - 1
If DataGridView3.Rows(i).Cells(1).Style.BackColor = Color.White Then
For j As Integer = LBound(newcolegeprin) To UBound(newcolegeprin)
If Trim(UCase(DataGridView3.Rows(i).Cells(1).Value)) Like "*" & Trim(UCase(newcolegeprin(j))) & "*" And newcolegeprin(j) <> "" Then
If newexactmatchingdata(Trim(UCase(DataGridView3.Rows(i).Cells(1).Value)), (j + 1)) = True Then
DataGridView3.Rows(i).Cells(2).Value = "4"
DataGridView3.Rows(i).Cells(1).Style.BackColor = Color.Cyan
Exit For
Else
Exit For
End If
End If
Next
End If
Next
End Sub
=================
Function newexactmatchingdata(ByVal wrdsting As String, ByVal arrno As Integer)
newexactmatchingdata = False
Dim kkkk As Integer
Dim nn As Integer
Dim mk As Integer
Dim newwrd() As String = Split(Trim(wrdsting), " ")
kkkk = UBound(newcolegeprin)
Dim match() As Boolean
ReDim match(Val(kkkk))
Dim abc As Boolean
For mk = 0 To UBound(newcolegeprin)
If Trim(UCase(newcolegeprin(mk))) <> "" Then
For nn = 0 To UBound(newwrd)
abc = False
If Trim(UCase(newwrd(nn))) = Trim(UCase(newcolegeprin(mk))) Then
abc = True
Exit For
End If
Next
If abc = True Then
match(mk) = True
Else
match(mk) = False
End If
End If
Next
For mk = 0 To UBound(match)
If match(mk) = False Then
Exit Function
End If
Next
newexactmatchingdata = True
End Function
No comments:
Post a Comment