Solved

Simple C++ questions concerning Borland C++ Builder

Posted on 2008-06-14
4
669 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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. …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

739 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