Solved

Delphi Programming question

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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