Hi all,
will you able to help me in this case?
I have a ListBox3 wich conatins this lines:
Car Dog House John
Car Dog House Gregor
Car Dog House Thomas
and i would like to show the result in a[dispaly] variable if pick the name of the person from a combobox1, I try to do somethig like this but it wont work:
SetVar "[display]" ""
ListBoxSize "ListBox3" "[Count]"
Loop "1" "[Count]" "[N]"
ListBoxGetItem "[ListBox3]" "[N]" "[Item]"
SearchStr "[combobox1]" "[Item]" "[Pos]" ""
If "[Pos]" "=" "1"
SetVar "[display]" "[display][item][#13]"
Endif
EndLoop
Where is the problem? Because now there is 0 result.
Thank you!
D
SearchString Issue
Moderator: Neosoft Support
Re: SearchString Issue
Dudus:
What are the values in [combobox1] ?
a) If the values are an exact match e.g. ...
Car Dog House John
Car Dog House Gregor
Car Dog House Thomas
... then the code should work ... you can try this code and post the results of the AlertBox commands ...
b) However, if the values are something like ...
Dog
House
Thomas
... then you need to change ...
... to ...
... as you need to catch a match in any position other than zero.
What are the values in [combobox1] ?
a) If the values are an exact match e.g. ...
Car Dog House John
Car Dog House Gregor
Car Dog House Thomas
... then the code should work ... you can try this code and post the results of the AlertBox commands ...
Code: Select all
SetVar "[display]" ""
ListBoxSize "ListBox3" "[Count]"
AlertBox "Trace1" "combobox1=[combobox1],Count=[Count]"
Loop "1" "[Count]" "[N]"
ListBoxGetItem "[ListBox3]" "[N]" "[Item]"
SearchStr "[combobox1]" "[Item]" "[Pos]" ""
If "[Pos]" "=" "1"
SetVar "[display]" "[display][item][#13]"
Endif
AlertBox "Trace2" "N=[N], Item=[Item], Pos=[Pos]"
EndLoop
Dog
House
Thomas
... then you need to change ...
Code: Select all
If "[Pos]" "=" "1"
Code: Select all
If "[Pos]" ">" "0"
Last edited by Gaev on Wed Nov 29, 2017 5:55 am, edited 1 time in total.
Re: SearchString Issue
Thank you Gave, works perfect!
Dududs!
Dududs!