Forum Discussion

DevPerera's avatar
DevPerera
Occasional Contributor
9 years ago
Solved

How to check whether drop-down contain duplicate values or not?

Hi All,   I want to know how to check whether drop-down contain duplicate values or not? I am using Testcomplete version 11. Also I am uing VB scripts. My appraoch is first creat an array with a...
  • DevPerera's avatar
    DevPerera
    9 years ago

    Hi Colin,

     

    Thanks for your reply.

    However I found a solution from some other site, written in VB.

     

    Following is my code.

    Sub Check_duplicate()
    listcount = myselectobject.wItemCount
    listcount = listcount - 1
    listone = myselectobject.wItemList
    Log.Message "select object list; " & listone
    aList = split(myobj1,";")
    For x = 0 To listcount
    If InStr(sNewList,(aList(x) & ";")) <= 0 Then
    sNewList = sNewList & aList(x) & ";"
    End If
    Next
    listtwo = Left(sNewList,Len(sNewList)-1)
    Log.Message "select object list; " & listtwo
    If listone <> listtwo Then
    Log.Message "duplicate found"
    Else
    Log.Message "No duplicate found"
    End If

    End Sub

     

    ...................

    Thanks

    Dev