Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Nov 19, 2017 5:28 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: redim seems not to be working - confused!
PostPosted: Wed May 08, 2013 5:18 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: redim seems not to be working - confused!
PostPosted: Wed May 08, 2013 6:58 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
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
 Profile  
Reply with quote  
 Post subject: Re: redim seems not to be working - confused!
PostPosted: Thu May 09, 2013 2:21 am 
Offline

Joined: Wed Aug 27, 2008 7:36 am
Posts: 10
Thanks for that. Next line was
control_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
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group