New topic: 

PopupMenu Ascending Order?

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

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        RicSum          Post subject: PopupMenu Ascending Order?Posted: 
Fri May 17, 2013 12:11 pm                         
Joined: Fri Jun 05, 2009 4:54 pm
Posts: 481
Location: London, England                Hi,
My popupmenu is populated from a database and the code below works perfectly, 
HOWEVER,
would it be possible to modify the code in order to cause the entries in the 
popupmenu to be displayed in Ascending order ?


Dim stSQL as String

If db8.Connect = True Then
  stSql = "SELECT Sonames FROM SettingsTable"
  rs8 = dB8.SQLSelect(stSql)
  
  if rs8 = nil then
  msgbox "Problem with Database!"
  
  else
  while not rs8.EOF
  win_Add.PopupMenu2.AddRow rs8.Field("Sonames").StringValue
  rs8.MoveNext
  wend
  end
end if
rs8.Close


Thank you all in advance.      
_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8  
                             Top                timhare          Post subject: 
Re: PopupMenu Ascending Order?Posted: Fri May 17, 2013 12:31 pm                 
        
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12340
Location: Portland, OR  USA                Add an ORDER BY clause to your sql 
statement to retrieve them in the order you want.

select sonames from SettingsTable order by sonames   
                             Top                RicSum          Post subject: 
Re: PopupMenu Ascending Order?Posted: Fri May 17, 2013 12:53 pm                 
        
Joined: Fri Jun 05, 2009 4:54 pm
Posts: 481
Location: London, England                Duhhhh,
Thanks Tim     
_________________
RealStudio Professional Edition 2012 r2
Developing on OS X 10.8 (Mountain Lion)
Deploying on Windows XP / Vista / 7 / 8  
                             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