Problem with dynamic string array

Hi All

I do have the following problem

I declare a string array here

  private
    Details : array of array of String;
    //Details : Array[0..53,0..3] of string;


somewhere in the code I assign values to it

  SetLength(Details, 53,3);

  for i := 0 to 52 do begin
    Details[i,0] := '-';
    Details[i,1] := IntToStr(i);
    Details[i,2] := FullName;
    Details[i,3] := prio;
  end;

everything is fine, but if I then call via a Button Event

//Details := nil;
Release;

I got Exeptions.
If I do this with a non Dynamic Array everything is fine, what do I wrong

Thanks for Help
Martin
0
Martin
1/15/2012 10:06:50 AM
embarcadero.delphi.intraweb 3901 articles. 1 followers. Follow

3 Replies
474 Views

Similar Articles

[PageSpeed] 18

Don't forget !

Every (client)session use same arrays and variables.

My applicaion work correct just one client. I could not find How can I resolve multiple client. 
I know Session an hidden field methot. But I need using array method.

Does anyone experiencing a problem like this before?


> {quote:title=Martin Sickel wrote:}{quote}
> Hi All
> 
> I do have the following problem
> 
> I declare a string array here
> 
>   private
>     Details : array of array of String;
>     //Details : Array[0..53,0..3] of string;
> 
> 
> somewhere in the code I assign values to it
> 
>   SetLength(Details, 53,3);
> 
>   for i := 0 to 52 do begin
>     Details[i,0] := '-';
>     Details[i,1] := IntToStr(i);
>     Details[i,2] := FullName;
>     Details[i,3] := prio;
>   end;
> 
> everything is fine, but if I then call via a Button Event
> 
> //Details := nil;
> Release;
> 
> I got Exeptions.
> If I do this with a non Dynamic Array everything is fine, what do I wrong
> 
> Thanks for Help
> Martin

Edited by: Barış Kılınç on Jan 15, 2012 1:22 PM
0
Utf
1/15/2012 9:23:56 PM
"Martin Sickel" <martin@die-sickels.de> schreef in bericht 
news:436248@forums.embarcadero.com...
> Hi All
>
> I do have the following problem
>
> I declare a string array here
>
>  private
>    Details : array of array of String;
>    //Details : Array[0..53,0..3] of string;
>
>
> somewhere in the code I assign values to it
>
>  SetLength(Details, 53,3);
>
>  for i := 0 to 52 do begin
>    Details[i,0] := '-';
>    Details[i,1] := IntToStr(i);
>    Details[i,2] := FullName;
>    Details[i,3] := prio;
>  end;
>

You cannot assign to Details[*,3], unless you use SetLength(Details,*,4)
Tom
0
Tom
1/17/2012 12:10:27 PM
news:436367@forums.embarcadero.com...
> Every (client)session use same arrays and variables.
>
> My applicaion work correct just one client. I could not find How can I 
> resolve multiple client.
> I know Session an hidden field methot. But I need using array method.
>
> Does anyone experiencing a problem like this before?

When the array elements are read-only, you can declare the array in a global 
unit. Every session can use it.
When the array elements can be modified by a session, you will have to 
declare it in the UserSession. Maybe copy initial data from a global array.
Tom
0
Tom
1/17/2012 12:14:24 PM
Reply:

Similar Artilces:

problem with dynamic array of dynamic array
var a:array of array of integer; begin setlength(a,2); setlength(a[0],1); setlength(a[1],2); a[0,0]:=1; //it is ok a[0,1]:=2; //it is not ok in my understanding a[0,1]:=2 is not ok because a[0] has only one element as i declared setlength(a[0],1) so i dont understand why this code exemple is compiled and run just fine ? > {quote:title=Yossi Rozenberg wrote:}{quote} > in my understanding a[0,1]:=2 is not ok because a[0] has only one element as i declared setlength(a[0],1) so i dont understand why this code exemple is compiled and run just fine ? By default, acces...

MOVED: problem with dynamic array of dynamic array
Moved to: embarcadero.public.delphi.language.delphi.general or: https://forums.embarcadero.com/thread.jspa?threadID=57076 -- Rudy Velthuis Rudin's Law: In a crisis that forces a choice to be made among alternative courses of action, people tend to choose the worst possible course. ...

Adding Parameters dynamically for search string from string array
I am building a search string dynamically. One of the items for the string is stored in a sting array in a ViewState object. I want to be able to retrieve the values from the ViewState object and create the string. I have part of the code here and need help in completing the portion indicated. Main problem is how do I build the string for the parameter values. Thanks in advance. OracleCommand cmd = conn.create(); if ( ViewState ["stringArray"]!=null ) {String [] stringArray=ViewState ["stringArray"];if ( stringArray.Length>0 ) { if ( stringArray.Length==1 ) ...

problems parsing array or associative array (of strings) in from RenderScript
I can not find a way for my atlas server RendScript to contain a subnode representing an array or associative array and pass this information to the client object (successfully at least). Atlas seems to want a sophisticated object contained as array elements. Is there anyway to have an array (from RenderScript) parse easliy by atlas client object? The sample RendScript code here:  protected override void RenderScript(ScriptTextWriter writer, Control targetControl) {   Foo foo = targetControl as Foo;   FooExtenderProperties properties = GetTargetPro...

Problem accessing an array from a string which contains the name of the array
I am trying to access the elements of an array by using javascript on the client side.  The array is registered to the page using the ClientScript.RegisterArrayDeclaration function from the server side. The problem is that I don't know what the name of the array is going to be at design time because it is created dynamically from my server side script so I can't just have a line in my javascript code that says for example: MyArray5[0] I have to have a variable that turns out to be a string containing the name of the array using code similar to: var myArrayName&nbs...

Creating dynamic array,adding stringsinto the array and retrieving string
hi, I want to create a dynamic array which will contain string......then dynamically I will add strings to the array....At the end how i will retrieve strings from that array...... for example....i have a textbox, a button named add, and a button named show...... 1st i will write some string in the textbox....whene i click on the ADD button.the string wriiten in the textbox will be added to the array.....again i will write another string in textbox...again click the ADD button....that will be added to the array................. so at the end when i click on the SHOW button, I want to see ...

String array problem
Hi all! I had this problem with string arrays. The situation was the following: a) the string array was populated using the ProfileString command from an ini file. b) later, the string array elements were used as arguments in datawindows Retrieve method The problem was that the datawindows appeared empty (0 rows), the cause of it was that the string array arguments were not readed properly. For example if the ini file input string was literally written as "001" the Retrieve method received the argument as it should be, checked using Appeon Debug, but it was not abl...

Problem with String[] Arrays
What the problem with the code below, the red part is complaining that Argument '1': cannot convert from 'string[]' to 'string'Why?public static void Main(string[] args)        {            string[] FilesToBeZipped = { "C:\\zip\\Roger.doc", "C:\\zip\\Roger2.doc", "C:\\zip\\Roger3.doc" };            RunZip(FilesToBeZipped, "Obinna.Zip");        }            &nbs...

Trying to dynamically create arrays, getting can't use string as ARRAY ref
Greets. I have a 'config file' that contains a group name (alphanumeric) and machine name/numbers separated by whitespace. Each group is on it's own line. The file looks like this: prod01 456 345 234 prod02 789 517 325 ....etc, etc, etc... What I am attempting to do is: Put the file contents into an array Pull the first entry off the array Add the name of the array to a 'master array' list of the machine groups Then create another array, which would be referenced by the group name, and contains the machines associated with the group. Here is the code...

Weird problem passing string array: Cannot deserialize object graph into type of 'System.String[]'
Hi-I have a strange error occurring, which I can't seem to figure out.  I'm passing an array of strings to a prototyped function, which in turn calls an Atlas function:SomeTest.prototype.TestArrayPassing= function (myarray) {    BridgeCanada.WebServices.TestService.TestArray(          myarray,        {            onMethodComplete: Function.createDelegate(this, this.OnTestArrayComplete),         &n...

Delphi XE3 Intraweb have a problem
I was developed using Delphi XE3 Intraweb, and have a problem. The object "IWServerController" port has set 9000. However, when I run the program, the HTTP port will become 1540, and each time this port will add one, and cannot be fixed. I would like to ask how to exclude the problem, thank you. > {quote:title=dennis liu wrote:}{quote} > I was developed using Delphi XE3 Intraweb, and have a problem. > The object "IWServerController" port has set 9000. However, when I run the program, the HTTP port will become 1540, and each time this port will add one, and...

Simple Array String problem
hi, I have defined an array string dim string_array() as string and now i want it to be cleared before i set values to it, but i can't seem to handle that. ..clear doesn't work, it requires some extra parameters such as array, index, and integer. is there something out there, that's new for me to learn. please help Are you aware of the ArrayList? It has a Clear() method: ArrayList al = new ArrayList(); al.Clear(); i did finally get it done with Arraylist, but was wondering if the same effect is possible using ArrayString, instead of Arraylist thank you ...

Delphi
Hi, I'm trying to make an application that connects to the specyfic device and read some data... thay are in strings... Device producer give Delphi library that works but instead of number (string with number '1234.67') I get kind of chinesse letters.. if I do AnsiString := String there is '??????d' string instead od chinnesse :-) with other string I get without last letter i.e.: 'Unknow'. http://i.imgur.com/jP47wgC.png The library was made for Delphi 7 and is open in XE5... In future I'd like to use it in FMX also... Sebastian wrote: > I&#...

byte array to string problem
Hi all,       I'm trying to print out a byte [] using the .ToString() method. But it just prints out "System.byte[]".  Why is it like this??? Normally types print out their type name in ToString method , that's the default implementation, unless there are some for which converting to string makes more sense (such as integer to string).With byte array, the implementation comes from the base class System.Array (base class for all arrays). If you want to print the byte array, you can loop it through and generate the string yourself from individual ...

Web resources about - Problem with dynamic string array - embarcadero.delphi.intraweb

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

Refugee crisis: Germany has a problem
GERMANY is a country on edge.

Star Wars and the problem with perfection
Building a truly iconic story like Star Wars is a bit of alchemy, requiring unpredictable lightning strikes of creativity. You can't do it over ...

A truly Canadian problem: Who do I complain to about Netflix?
The CRTC is promising some new code of conduct for the broad TV industry, including possibly video streaming, this year. But having already blinked ...

The Suns biggest problem? Their players aren't good enough
The Phoenix Suns scapegoated two of their assistant coaches for their struggles, but the bottom line is, they don't have enough talent to compete. ...

Valve explains: DDoS-induced caching problem led to Xmas Day Steam data leaks and downtime
PC gamers were dismayed on Christmas Day to find that Valve's popular (and arguably essential) Steam store had gone haywire before becoming entirely ...

Fullsize GM SUVs have a problem that's making owners sick
Filed under: Cadillac , Chevrolet , GM , GMC , Safety , SUV A buffeting and vibration problem for some owners of GM's fullsize SUVs can be bad ...

First admitting there is a problem by @BloggersRUs
First admitting there is a problem by Tom Sullivan Nancy LeTourneau at Political Animal wrote yesterday about the crisis of confidence in the ...

How Facebook engineers cleverly hacked their way around a time-wasting problem with Oculus
Facebook programmers had a problem. They were working on developing games and experiences for virtual reality, by way of Facebook's own Oculus ...

December 2015: Unofficial Problem Bank list declines to 250 Institutions, Q4 2015 Transition Matrix
This is an unofficial list of Problem Banks compiled only from public sources. Here is the unofficial problem bank list for December 2015. Changes ...

Resources last updated: 1/4/2016 12:28:15 PM