New topic: redim seems not to be working - confused!
<http://forums.realsoftware.com/viewtopic.php?t=47824> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message aulay Post subject: redim seems not to be working - confused!Posted: Wed May 08, 2013 5:18 pm Joined: Wed Aug 27, 2008 7:36 am Posts: 10 I have a very simple bit of code which isn't doing what it should and I'm most perplexed. The code below has all be cut and pasted directly from a subroutine. It should dim a set of arrays (four string, one integer) and then redim them to fix their required sizes. All very simple. dim control_temp(-1),control_temp2(-1), control_temp3(-1),control_temp4(-1) As String dim deleteme(-1) as integer redim control_temp(max_years) redim control_temp2(max_years) redim control_temp4(max_thresholds-1) redim deleteme(max_years) However, when I debug the programme, it seems that whilst the integer array is sized appropriately, the string arrays are not. Instead I get a report which says (when max_years=70 and (max_thresholds-1)=40) Quote:control_temp String(60) control_temp2 String(60) control_temp3 String(40) control_temp4 String(40) deleteme Int32(70) This all makes no sense to me. It's getting late and I'll look again tomorrow, but any ideas very welcome _________________ Mac OS 10.8.3 RS 2011r1 Top npalardy Post subject: Re: redim seems not to be working - confused!Posted: Wed May 08, 2013 6:58 pm Real Software Engineer Joined: Sat Dec 24, 2005 8:18 pm Posts: 7833 Location: Canada, Alberta, Near Red Deer trying 2011r4.3 here and I cant get it to do what you're saying I'd put a break point on the first DIM in your code and check the values are what you expect & then single step _________________ Norman Palardy (Real Software) Top aulay Post subject: Re: redim seems not to be working - confused!Posted: Thu May 09, 2013 2:21 am Joined: Wed Aug 27, 2008 7:36 am Posts: 10 Thanks for that. Next line wascontrol_temp= Split(s, chr(9)) (and more similar) and I'd forgotten that Split redim-ed the array, negating the initial setting. Duh. Your prompt appreciated. _________________ Mac OS 10.8.3 RS 2011r1 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
