Loading...

gambas-user@lists.sourceforge.net

[Prev] Thread [Next]  |  [Prev] Date [Next]

[Gambas-user] String array empty after SUB (Gambas 2) Rolf-Werner Eilert Wed Feb 22 09:02:03 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


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Gambas-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gambas-user