Hi, everybody! I'm currently building a C++ Forms application for my supervisor to track employee sick/vacation time. The program reads each employee's information from a file, and I want to be able to display each employees information in a label.
(The binary files have been created successfully and the file streaming is functioning)

However, the amount of employees is subject to change, so I don't want to have to create and hide 800 labels. :P

I've been searching for information on how to dynamically create and delete labels at runtime but all I seem to find is info for C# or VB.

Any sort of link or advice would be greatly appreciated.

Thanks!

Recommended Answers

All 3 Replies

As far as VCL is concerned, a Label is created at runtime as:

TLabel *myLabel = new TLabel(<Owner Handle>);

It's not too bad:

Label^ lbl = gcnew Label();
//fill in the Location property (specify by System::Drawing::Point(x,y))
//fill in the Text property
Controls->Add(lbl);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.