<michaelkoop at t-online dot de> wrote:
> dim n as integer
> dim t as string
>
> n=ListBox1.ListCount-1
> for i=0 to n
> if ListBox1.Selected(i)=true then
> t=t+trim(ListBox1.Cell(i,SpalteINr))+","
> end if
> next
> EditField2.Text=t
und jetzt machen wir das noch schneller:
dim n as integer
dim a(-1) as string
n=ListBox1.ListCount-1
for i=0 to n
if ListBox1.Selected(i) then
a.Append trim(ListBox1.Cell(i,SpalteINr))
end if
next
EditField2.Text=Join(a,",")
Wenn du willst kannst du auch noch ein "," dranhängen am Schluss.
if ListBox1.Selected(i)=true then
ist übrigends ein =true mehr als nötig.
Und für die ganz schlauen noch eine Frage:
Warum ist
t=t+(trim(ListBox1.Cell(i,SpalteINr))+",")
mindestens theoretisch schneller als das hier:
t=t+trim(ListBox1.Cell(i,SpalteINr))+","
Mfg
Christian
--
Around ten thousand functions in one REALbasic plug-in. The MBS Plugin.
<http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>
|