[Gambas-user] String array empty after SUB (Gambas 2)

Rolf-Werner Eilert eilert-sprachen at ...221...
Wed Feb 22 17:41:53 CET 2012


Now, this is a strange one :-) and I really have no idea what goes wrong 
here.

I've got a dialog which loads a list of names. I'm keeping such SUBs 
that deal with files in a module called ldsv (brief for load-save).

The dialog's part is simple, "ls" is the listbox:

PRIVATE felder AS NEW String[]

PUBLIC SUB ls_Click()


   Label1.Text = "Nr. " & schlyssel[ls.Index] & ": " & ls[ls.Index].Text
'here we jump into the SUB:
   ldsv.ListeKundeFelder(schlyssel[ls.Index], felder)
'now we should see the number of fields loaded:
   lblTitel.Text = CStr(felder.Count)

END


Now the SUB in module ldsv:

PUBLIC SUB ListeKundeFelder(schlysselnr AS String, felder AS String[])
DIM t$ AS String
DIM feld AS NEW String[]

   felder.Clear

   t$ = File.Load(pfadKunden &/ schlysselnr & ".kunde")
   t$ = Tag2Str(t$)

   feld = Split(t$, Chr$(10))

   IF feld[0] = "#!Stein3.1" THEN
     feld.Delete(0, 2)               'das #! und die ID können weg
     felder = feld.Copy()
   END IF

END

When I put a stop at the END IF and watch the values, felder will have 
16 values from 0 - 15 containing strings just as expected. But when I 
return to the dialog, felder is empty! This is especially weird as there 
are other SUBs and FUNCTIONs en masse in my project that do it exactly 
the same way.

I cannot detect any mistake I made - or do you?

Regards

Rolf





More information about the User mailing list