Solved

Simple C++ questions concerning Borland C++ Builder

Posted on 2008-06-14
4
650 Views
Last Modified: 2012-08-13
1. I want to make the caption of label to be "The sum is:" SUM, where SUM is an integer. Label1->Caption = "The sum is" + SUM; doesn't work..
2. How do I change line in a label caption?

(these two questions are for borland c++ builder)

Thanks
0
Comment
Question by:Chrysaor
  • 2
4 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 125 total points
Comment Utility
>>  1. I want to make the caption of label to be "The sum is:" SUM, where SUM is an integer. Label1->Caption = "The sum is" + SUM; doesn't work..

Try :

        Label1->Caption = "The sum is " + IntToStr(SUM);


>> 2. How do I change line in a label caption?

Try :

        Label1->Caption = "The first line\nThe second line";

Notice the \n which starts a new line.
0
 

Author Comment

by:Chrysaor
Comment Utility
It doesn't change the line with \n ..
0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
>> It doesn't change the line with \n ..

What do you mean ? What do you see ?
0
 
LVL 2

Expert Comment

by:maggc
Comment Utility
Write

int intValue = 5;

Label1->Caption = "text" + AnsiString(intValue);

You can define WordWrap = true for the Label so it wraps the text if it is too long to fit into the current line. Or make 2 separate labels ;)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

728 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

10 Experts available now in Live!

Get 1:1 Help Now