On Wed, 2012-02-22 at 19:49 +0200, Jussi Lahtinen wrote:
> Just quick thought... maybe this "felder = feld.Copy()" gives new object
> reference feld to felder.
> And because feld is declared locally, the it is null after the sub and so
> is also felder.
> 
> Perhaps you need to do "felder = feld.Copy()" manually with for each...
> 
> Jussi
> 
> 
> 
> 
> On Wed, Feb 22, 2012 at 18:41, Rolf-Werner Eilert <
> eilert-sprac...@t-online.de> wrote:
> 
> > 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
Perhaps ... If feld[0] <> "#!Stein3.1" then felder=feld.Copy is never
executed! Try

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



------------------------------------------------------------------------------
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
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to