?
Solved

Delphi Programming question

Posted on 1997-09-02
1
Medium Priority
?
167 Views
Last Modified: 2010-05-18
Hello Delphiers.

OK, OK, I'm a newbe and probably this is the stupidest one you've seen;
But I want to convert my project to Delphi and get read of the
much hated VB ...(please help me)

I Was trying to convert the following VB code :


TYPE TMib
      Codice = String(4)
      Titolo = String(1)
      UC = Single;
END TYPE
...
PUBLIC Mib() = TMib
...
size = db.recordcount
redim mib(1 to size)
for count = 1 to size
      mib(count).Codice = db("codice")
      ....
Next count


The kindness of Bryan Valencia (Software Services - Making Windows Scream) helped me
see that if I needed resizable arrays of User Defined type I could use
TList, for TList is a resizeble arrray of objects.

NOW HERE START THE PROBLEM .......

I've tried the following code

unit G;

interface
uses
      classes;

type
      TMib = class(TObject)
                Codice : String[4];
                Titolo : String;
                Tipol  : String[1];
                Incr   : Integer;
                UltimoClose : Single;
end;

Type
      TMibList = class(TList)
end;

Var
      IsConnected, GiornataAperta : Boolean;
          Mib : TMibList;
          tmpMib : TMib;


.....

But every time I try to access the tmpMib or MIb variables I get stack overflows,
even after calling 'tmpMib.Create' (<- No error but the var is still nil )

      WHAT'S WRONG .....?

P.S. The documentation regarding the Object Pascal is (Edited by Computer101) !
      I, like may others, must write some quite complex programs,
      and all the books talk about are forms and ActiveX ....Thanks
      If anyoune can suggest a good book on the subject, it will be great

Great Thanks to anyone who'll read this, I know it has to be a stupid one !!!

      Mark Gesiot
      magesiot@tin.it
0
Comment
Question by:mgesiot
1 Comment
 
LVL 1

Accepted Solution

by:
flisakow earned 40 total points
ID: 1343347

The code to create objects is:
   tmpMib := TMib.Create;
   Mib := TMibList.Create;

by just calling the routine a variable was created, but you lost
the pointer to it.
 
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question