ciberperson
Programmer
I have been struggling with this for several days and have tried 3 different methods but to no avail. Perhaps someone can steer me in the right direction.
I have a form with a checklist of software; the users selects what they do not want. I want to find out what is left when you substract the user-checked list from the total list. So I have an aArry which is the total list and bArr which is what the user checked. I now want to compare them and create cArr.
These are the 3 solutions I have tried (divided by the asterisks) which have not worked. In all cases, it finds the first match but not any of the others. Thanks in advance!
***********************************************
strTemp = ""
For each strName2 in bArr
For each strName1 in aArr
If strName1 = strName2 Then strName1 = ""
Next
Next
For Each strName1 in aArr
If strName1 <> "" Then strTemp = strTemp & strName1 & ","
Next
cArr = Split(strTemp,",")
************************************************************
For Each str1 In aArr
bfound = False
For Each str2 In bArr
If str1 = str2 Then bfound = True
Next
If bfound = False Then
cArr(i) = str1
i = i + 1
End If
Next
For i = 0 to Ubound(cArr)
str1
Next
************************************************************
Dim aArr ' this Array will hold all PCC software listed on the pc
If strSoftware <> "" then
strSoftware = left(strSoftware,len(strSoftware)-1)
'response.write strSoftware & "<p>"
aArr = split(strSoftware,",")
ReDim Preserve aArr(Ubound(aArr))
'for i = 0 to Ubound(aArr)
' response.write aArr(i) & " = " & i & "<BR>"
'next
Dim bArr ' this is the software the user no longer wants
bArr = split(strCat1,",")
'for i = 0 to Ubound(bArr)
' response.write bArr(i)
'next
for apos=0 to ubound(aArr)
aValueFound = False
for bpos=0 to ubound(bArr)
If aArr(apos) = bArr(bpos) then
aValueFound = True
exit for
End If
next
If Not aValueFound Then
cvalues = cvalues & apos & "," ' assigns bookmarks
End If
next
if cvalues <> "" then
cvalues = left(cvalues, len(cvalues)-1) ' stripping the trailing comma off
cArr = split(cvalues, ",")
Dim C
Redim C(ubound(cArr))
for cpos=0 to ubound(cArr)
C(cpos) = aArr(cArr(cpos)) ' assigns the value from the bookmark
Next
Else
C = Split("",",")
End If
I have a form with a checklist of software; the users selects what they do not want. I want to find out what is left when you substract the user-checked list from the total list. So I have an aArry which is the total list and bArr which is what the user checked. I now want to compare them and create cArr.
These are the 3 solutions I have tried (divided by the asterisks) which have not worked. In all cases, it finds the first match but not any of the others. Thanks in advance!
***********************************************
strTemp = ""
For each strName2 in bArr
For each strName1 in aArr
If strName1 = strName2 Then strName1 = ""
Next
Next
For Each strName1 in aArr
If strName1 <> "" Then strTemp = strTemp & strName1 & ","
Next
cArr = Split(strTemp,",")
************************************************************
For Each str1 In aArr
bfound = False
For Each str2 In bArr
If str1 = str2 Then bfound = True
Next
If bfound = False Then
cArr(i) = str1
i = i + 1
End If
Next
For i = 0 to Ubound(cArr)
str1
Next
************************************************************
Dim aArr ' this Array will hold all PCC software listed on the pc
If strSoftware <> "" then
strSoftware = left(strSoftware,len(strSoftware)-1)
'response.write strSoftware & "<p>"
aArr = split(strSoftware,",")
ReDim Preserve aArr(Ubound(aArr))
'for i = 0 to Ubound(aArr)
' response.write aArr(i) & " = " & i & "<BR>"
'next
Dim bArr ' this is the software the user no longer wants
bArr = split(strCat1,",")
'for i = 0 to Ubound(bArr)
' response.write bArr(i)
'next
for apos=0 to ubound(aArr)
aValueFound = False
for bpos=0 to ubound(bArr)
If aArr(apos) = bArr(bpos) then
aValueFound = True
exit for
End If
next
If Not aValueFound Then
cvalues = cvalues & apos & "," ' assigns bookmarks
End If
next
if cvalues <> "" then
cvalues = left(cvalues, len(cvalues)-1) ' stripping the trailing comma off
cArr = split(cvalues, ",")
Dim C
Redim C(ubound(cArr))
for cpos=0 to ubound(cArr)
C(cpos) = aArr(cArr(cpos)) ' assigns the value from the bookmark
Next
Else
C = Split("",",")
End If