Jump to content

looking at array values + stringinstr


gcue
 Share

Recommended Posts

user inputs a serial number

HVFLB26412

that value appears in an array column but with other numbers/letters in front of it

HA19HVFLB26412

im thinking i need to use stringinstr

but what would that look like? here's what i have so far (not working tho)

For $u = 1 To $avOut[0][0]

        $search = StringInStr($avOut[$u][6], GUICtrlRead($serialno))

        If Not @error then

            MsgBox(0, "", "serial: " & $avOut[$u][6] & @CRLF & _
                    "asset: " & $avOut[$u][0] & @CRLF & _
                    "owner: " & $avOut[$u][13])
            
            $sn_found = True
        EndIf
        
    Next

thanks!

Edited by gcue
Link to comment
Share on other sites

user inputs a serial number

HVFLB26412

that value appears in an array column but with other numbers/letters in front of it

HA19HVFLB26412

im thinking i need to use stringinstr

but what would that look like? here's what i have so far (not working tho)

For $u = 1 To $avOut[0][0]

        $search = StringInStr($avOut[$u][6], GUICtrlRead($serialno))

        If Not @error then

            MsgBox(0, "", "serial: " & $avOut[$u][6] & @CRLF & _
                    "asset: " & $avOut[$u][0] & @CRLF & _
                    "owner: " & $avOut[$u][13])
            
            $sn_found = True
        EndIf
        
    Next

thanks!

You should not be checking @error, but existance of given substring:

For $u = 1 To $avOut[0][0]

    If StringInStr($avOut[$u][6], GUICtrlRead($serialno)) <> 0 Then
        MsgBox(0, "", "serial: " & $avOut[$u][6] & @CRLF & _
                "asset: " & $avOut[$u][0] & @CRLF & _
                "owner: " & $avOut[$u][13])
            
        $sn_found = True
    EndIf
        
Next

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...