[Gambas-user] Substitute of the object names

Biro Zoltan office.zolano at ...626...
Thu Oct 7 09:04:26 CEST 2010


Thank you Rolf to helping me.
Please take a look on the folowing piece of code:
(I never used array of texboxes, but I think is something like I did
here)

PUBLIC SUB filltheboxes()

 DIM x AS String[20]
 DIM y[20] AS TextBox
 DIM i AS Short

 x[0] = "1"
 x[1] = "2"
 x[2] = "3"
 x[3] = "4"
 x[4] = "5"
 x[5] = "6"
 x[6] = "7"
 x[7] = "8"
 x[8] = "9"
 x[9] = "10"
 x[10] = "11"
 x[11] = "12"
 x[12] = "13"
 x[13] = "14"
 x[14] = "15"
 x[15] = "16"
 x[16] = "17"
 x[17] = "18"
 x[18] = "19"
 x[19] = "20"
 
 i = 0
 FOR i = 0 TO 19
  y[i].text = x[i]
 NEXT 

END

Why this code return a "Null object" error code??

I hope to can be solved in Gambas2 more simply the substitute problem. I
used before FoxPro for Windows. Here is simple:

i=1
for i=1 to 20
  boxname="n"+str(i)
  &boxname.text=" enithyng "
endfor
Is something in Gambas2 similar for &boxname.text, like in Foxpro?

For me the second variant seems to be more simply, but please explain me
why I have "Null object" error on the gambas2 code


2010. 10. 7, csütörtök keltezéssel 08.23-kor Rolf-Werner Eilert ezt
írta:
> Am 07.10.2010 08:11, schrieb Biro Zoltan:
> > Hello,
> >
> > I will try to explain with my poor english exacly what I wish to do:
> >
> > 1.I have 20 pcs of valueboxes named: n1,n2,n3...n20
> > 2.I have a variable named i defined as short
> > 3.I wish to substitute the numbers from the valueboxes name like in
> > folowing example:
> >
> > i=0
> > for i=0 to list.count
> >
> >   'here I wist to give values to the valueboxes:
> >
> >   ni.value=list[i].text
> >
> > next
> >
> > Can I substitute the numbers with the value of i? How?
> >
> > Thank you.
> >
> > Zoli B.
> >
> >
> 
> Wouldn't it be easier to just make an array of valueboxes? That would 
> enable you to write
> 
> ni[i].value = list[i].text
> 
> and Gambas would have direct access to each of the valueboxes during 
> runtime.
> 
> Regards
> 
> Rolf
> 
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list