Solved

Delphi Programming question

Posted on 1997-09-02
1
137 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 20 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now