BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Displaying in Memo

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
undbund
Guest





PostPosted: Tue Apr 20, 2004 10:35 pm    Post subject: Displaying in Memo Reply with quote



Hi i have a small program which displays 5 numbers from 0 - 5, the code is:

for( int i = 0; i < 5; i++ )
{
Memo->Lines->Add(IntToStr(i));
}
The output in memo is:
0
1
2
3
4

How to display the output in this format?
0 1 2 3 4

thanx for all your help
undbund

Back to top
JD
Guest





PostPosted: Tue Apr 20, 2004 11:40 pm    Post subject: Re: Displaying in Memo Reply with quote




undbund <undbund (AT) yahoo (DOT) com> wrote:
Quote:
Hi i have a small program which displays 5 numbers from 0 - 5, the code is:

That would be 6 numbers <g>

Quote:
[...] How to display the output in this format?
0 1 2 3 4

Add adds a line. What you want to do is to format a single line and it:

int Limit = 5;
AnsiString s = "";
for( int i = 0; i < Limit; ++i )
{
s += IntToStr( i );
if( i < Limit - 1 ) s+= " ";
}
Memo->Lines->Add( s );

~ JD


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Apr 21, 2004 5:33 am    Post subject: Re: Displaying in Memo Reply with quote




"undbund" <undbund (AT) yahoo (DOT) com> wrote


Quote:
How to display the output in this format?
0 1 2 3 4

Alternatively to what JD suggested:

for( int i = 0; i < 5; i++ )
{
Memo->SelStart = Memo->GetTextLen();
Memo->SelLength = 0;
Memo->SelText = IntToStr(i) + " ";
if( i < 4 )
{
Memo->SelStart = Memo->GetTextLen();
Memo->SelLength = 0;
Memo->SelText = " ";
}
}


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.