Sign in to follow this  
Followers 0
gcue

looking at array values + stringinstr

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

that works perfectly!

thank you =)

Share this post


Link to post
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
Sign in to follow this  
Followers 0