New topic: 

search listbox data

<http://forums.realsoftware.com/viewtopic.php?t=47239>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        carlbutler7          Post subject: search listbox dataPosted: 
Sun Mar 10, 2013 4:27 am                         
Joined: Tue Jan 08, 2013 8:27 pm
Posts: 38                if len(search1.Text)=0 then
  listbox1.listindex=-1
else
  dim value As String = search1.Text
  Dim I As Integer
  dim FoundAt As Integer = -1
  FoundAt = -1
  for i = 0 to listbox1.ListCount-1
  if instr(listbox1.cell(i,listbox1.SortedColumn),value) > 0 then
  FoundAt = i
  exit
  end
  next
  if FoundAt >= 0 then
  listbox1.ListIndex = FoundAt
  else
  listbox1.listindex=-1
  end if
end if


Search1.Text = ""


this is my code to search the listbox but i only want it to search the first 
column which is the ID column can anyone show me where i'm going wrong

thanks
carl   
                             Top                DaveS          Post subject: 
Re: search listbox dataPosted: Sun Mar 10, 2013 11:04 am                        
         
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4651
Location: San Diego, CA                change listbox1.SortedColumn to 0

and simplfy this
if FoundAt >= 0 then
  listbox1.ListIndex = FoundAt
else
  listbox1.listindex=-1
end if


to this
listbox1.listindex= FoundAt


Also you are search for rows that CONTAIN a value (instr) not columns that 
EQUAL a value      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                carlbutler7          Post 
subject: Re: search listbox dataPosted: Sun Mar 10, 2013 11:37 am               
          
Joined: Tue Jan 08, 2013 8:27 pm
Posts: 38                thanks!!!   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to