After two years of C#, my VB.net is a bit rusty. I have two List. Let's call it originalList and targetList. Here is my C# code.
for(int i = 0; i<originalList.Count; i++)
{
bool isMatch = false;
foreach (string t in targetList)
{
if(String.Compare(originalList[i], t, true) == 0)
{
isMatch = true;
break;
}
}
if(isMatch)
{
originalList.RemoveAt(i);
i--;
}
}
and my VB.net code is this
dim i as integer
for i = 0 To originalList.Count - 1
dim isMatch as boolean = false
for each t as string in targetList
if String.compare(originalList(i), t, true) = 0 then
isMatch = true
Exit for
end if
next
if isMatch then
originalList.RemoveAt(i)
i -= 1
end if
next
but i got index out of range error with my vb.net code. where did i get it wrong?
thank