P persianpowerman1 Active Member Licensed User Longtime User Oct 23, 2013 #1 guys... I am comparing the selected item in a Listview... to a selected item in a Spinner and you can see the log sheet for the corresponding values... ie.. ListView1.GetItem(list1_click) = 2 and Spinner1.GetItem(spinner_click) = 2 so when i am comparing them.. this is suppose to be a TRUE... but in the IF Then condition.. it jumps to ELSE??? why is that??? (list1_click and spinner_click)... are only to save the array No. of the item selected is there something wrong with the code??? or does it not work with numbers???? YO!han
guys... I am comparing the selected item in a Listview... to a selected item in a Spinner and you can see the log sheet for the corresponding values... ie.. ListView1.GetItem(list1_click) = 2 and Spinner1.GetItem(spinner_click) = 2 so when i am comparing them.. this is suppose to be a TRUE... but in the IF Then condition.. it jumps to ELSE??? why is that??? (list1_click and spinner_click)... are only to save the array No. of the item selected is there something wrong with the code??? or does it not work with numbers???? YO!han
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2013 #2 The thread title should describe the issue or question. Can you post the complete project (File - Export as zip)? Upvote 0
The thread title should describe the issue or question. Can you post the complete project (File - Export as zip)?
P persianpowerman1 Active Member Licensed User Longtime User Oct 23, 2013 #3 yes i can.. will be home in 2hrs.. will do so... however it works with string. . not with numbers?!?! Upvote 0
yes i can.. will be home in 2hrs.. will do so... however it works with string. . not with numbers?!?!
D DouglasNYoung Active Member Licensed User Longtime User Oct 23, 2013 #4 Persianpowerman, I had similar issues only it was comparing values from a Button.Tag. If I logged both values they appeared the same, but in a compare weren't! I suspect it was a issue of variable types, so I solved it by explicitly forcing them to be integers I.e. Code: Copy dim lval, sval as int lval = ListView1.GetItem(list1_click) sval = Spinner1.GetItem(spinner_click) Log(lval=sval) It worked for me, Douglas Upvote 0
Persianpowerman, I had similar issues only it was comparing values from a Button.Tag. If I logged both values they appeared the same, but in a compare weren't! I suspect it was a issue of variable types, so I solved it by explicitly forcing them to be integers I.e. Code: Copy dim lval, sval as int lval = ListView1.GetItem(list1_click) sval = Spinner1.GetItem(spinner_click) Log(lval=sval) It worked for me, Douglas
P persianpowerman1 Active Member Licensed User Longtime User Oct 23, 2013 #5 hey douglas.. thats what i did too.. then it worked i saved both of them in variables.. and then compared them... it did work! But still ... its weird.. beats my logic!?! Erel... buddy.. heres the stuff.. i was doing a lill RnD with them... the click event of Button1 is where i got stuck... its where im comparing a selected item from the LISTVIEW with a selected item from SPINNER the click event of Button2.. works fine... Attachments IndexOf.zip IndexOf.zip 499.1 KB · Views: 470 Upvote 0
hey douglas.. thats what i did too.. then it worked i saved both of them in variables.. and then compared them... it did work! But still ... its weird.. beats my logic!?! Erel... buddy.. heres the stuff.. i was doing a lill RnD with them... the click event of Button1 is where i got stuck... its where im comparing a selected item from the LISTVIEW with a selected item from SPINNER the click event of Button2.. works fine...
P persianpowerman1 Active Member Licensed User Longtime User Oct 24, 2013 #7 hi eps, could you tell me.. how would you find that out? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 24, 2013 #8 You are comparing 2 with "2". The compiler cannot know the type because the variables type in this case is Object. You should explicitly set the type. For example: Code: Copy Dim s1 = ListView1.GetItem(list1_click), s2 = Spinner1.GetItem(spinner_click) As String If s1 = s2 ... Note that you should use File - Export as zip when uploading projects. Upvote 0
You are comparing 2 with "2". The compiler cannot know the type because the variables type in this case is Object. You should explicitly set the type. For example: Code: Copy Dim s1 = ListView1.GetItem(list1_click), s2 = Spinner1.GetItem(spinner_click) As String If s1 = s2 ... Note that you should use File - Export as zip when uploading projects.
P persianpowerman1 Active Member Licensed User Longtime User Oct 24, 2013 #9 oh!!!! ok... i get it... thanx.. this made sense.. yup will use the file export function. .. dint know about it guys.. thanx once again : -) Upvote 0
oh!!!! ok... i get it... thanx.. this made sense.. yup will use the file export function. .. dint know about it guys.. thanx once again : -)