Solved

Simple C++ questions concerning Borland C++ Builder

Posted on 2008-06-14
4
674 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 125 total points
ID: 21787695
>>  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
ID: 21788121
It doesn't change the line with \n ..
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 21788162
>> It doesn't change the line with \n ..

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

Expert Comment

by:maggc
ID: 22441008
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

615 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