Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple C++ questions concerning Borland C++ Builder

Posted on 2008-06-14
4
Medium Priority
?
684 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 500 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

Technology Partners: 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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

824 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