Edit box - multiline

Hi All,

I want to create a simple program which has to write in an editbox numbers 
from 1 to 10, each on a different line.

I created an integer member variable and I use a for loop to generate the 
numbers, but I don't know how to display them on different lines in the 
editbox.

Any help appreciated

Regards,
Nicolae


0
nospam6568 (71)
1/17/2005 11:53:44 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
432 Views

Similar Articles

[PageSpeed] 12

Just insert "\r\n".

-- 
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

"Nicolae Fieraru" <nospam@please.com> wrote in message
news:41ec500a$1@duster.adelaide.on.net...
> Hi All,
>
> I want to create a simple program which has to write in an editbox numbers
> from 1 to 10, each on a different line.
>
> I created an integer member variable and I use a for loop to generate the
> numbers, but I don't know how to display them on different lines in the
> editbox.
>
> Any help appreciated
>
> Regards,
> Nicolae
>
>


0
jwood (1291)
1/18/2005 12:48:01 AM
"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:OnucCeP$EHA.3504@TK2MSFTNGP12.phx.gbl...
> Just insert "\r\n".
Hi Jonathan, thanks for the information. I don't know what is the command to 
insert strings.
And I have an integer member variable which I show in the edit box, maybe 
there are some commands which allow us to insert integers on the next line.

Regards,
Nicolae


0
nospam6568 (71)
1/18/2005 1:19:35 AM
You said the problem was that you didn't know how to put the information on
separate lines. You left out that you didn't know how to put a variable in
an edit box.

Is this for some type of homework assignment or something?

-- 
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

"Nicolae Fieraru" <nospam@please.com> wrote in message
news:eZmPJvP$EHA.3472@TK2MSFTNGP14.phx.gbl...
>
> "Jonathan Wood" <jwood@softcircuits.com> wrote in message
> news:OnucCeP$EHA.3504@TK2MSFTNGP12.phx.gbl...
> > Just insert "\r\n".
> Hi Jonathan, thanks for the information. I don't know what is the command
to
> insert strings.
> And I have an integer member variable which I show in the edit box, maybe
> there are some commands which allow us to insert integers on the next
line.
>
> Regards,
> Nicolae
>
>


0
jwood (1291)
1/18/2005 1:32:50 AM
> You said the problem was that you didn't know how to put the information 
> on
> separate lines. You left out that you didn't know how to put a variable in
> an edit box.
>
> Is this for some type of homework assignment or something?

I am able to put the integer variable in the edit box.
Here is my code:

void CMFCApp1Dlg::OnButton2()
{
 // TODO: Add your control notification handler code here
 int i;
 for(i = 0; i < 10; i++)
 {
  m_nMemo = i;
  UpdateData(false);
 }
}

This is not an assignment, or, if you wish, it is a self-assignment.
I do programming with Borland C++ Builder, and they have a different (and 
elegant) way of adding lines in a memo box.
Memo1->Lines->Add("My String" + IntToStr(MyNumber));

At present I try to create very simple programs with Visual C++ and I have a 
hard time finding information about how to use basic controls.

Regards,
Nicolae



0
nospam6568 (71)
1/18/2005 2:02:09 AM
"Nicolae Fieraru" <nospam@please.com> wrote in message 
news:OZ8X7GQ$EHA.2196@TK2MSFTNGP14.phx.gbl...
>> You said the problem was that you didn't know how to put the information 
>> on
>> separate lines. You left out that you didn't know how to put a variable 
>> in
>> an edit box.
>>
>> Is this for some type of homework assignment or something?
>
> I am able to put the integer variable in the edit box.
> Here is my code:
>
> void CMFCApp1Dlg::OnButton2()
> {
> // TODO: Add your control notification handler code here
> int i;
> for(i = 0; i < 10; i++)
> {
>  m_nMemo = i;
>  UpdateData(false);
> }
> }
>
> This is not an assignment, or, if you wish, it is a self-assignment.
> I do programming with Borland C++ Builder, and they have a different (and 
> elegant) way of adding lines in a memo box.
> Memo1->Lines->Add("My String" + IntToStr(MyNumber));
>
> At present I try to create very simple programs with Visual C++ and I have 
> a hard time finding information about how to use basic controls.
>
> Regards,
> Nicolae
>
>
>

Instead of making your member variable an int, make it a string and you can 
do it something like this...

CString strTmp;
m_strMemo.Empty();
for( int i= 1; i <= 10; i++ )
{
    strTmp.Format( _T("%d\r\n"), i );
    m_strMemo += strTmp;
}
UpdateData( FALSE );

or simply...

CString strTmp;
m_strMemo.Empty();
for( int i= 1; i <= 10; i++ )
{
    strTmp.Format( _T("%d\r\n"), i );
    m_strMemo += strTmp;
}
GetDlgItem( IDC_MY_EDIT_BOX )->SetWindowText( m_strMemo );

-- 
============
Frank Hickman
Microsoft MVP
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


0
1/18/2005 3:02:18 AM
In addition to using \r\n to make it multi line, you will also need to turn
on the multi line style of your edit control.

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"Nicolae Fieraru" <nospam@please.com> wrote in message
news:41ec500a$1@duster.adelaide.on.net...
> Hi All,
>
> I want to create a simple program which has to write in an editbox numbers
> from 1 to 10, each on a different line.
>
> I created an integer member variable and I use a for loop to generate the
> numbers, but I don't know how to display them on different lines in the
> editbox.
>
> Any help appreciated
>
> Regards,
> Nicolae
>
>


0
ajaykalra (6840)
1/18/2005 3:23:02 AM
Thank you Frank, that was the kind of advice I was looking for

Regards,
Nicolae 


0
nospam6568 (71)
1/18/2005 3:35:33 AM
Reply:

Similar Artilces:

Editing Text when using Publisher as a web page...
I'm using Publisher to document the status of current taskings in the office. I'm trying to ger Publisher to allow people that pull up the web-page to add and edit text on the web page so we can keep everything up to date. Right now, someone has to come to me and tell me the changes, then I change the info in the Pub doc, then I have to repost the web-page. Is there a way for people to edit the text on the web-page when they pull it up. I have text boxes in there now that people can edit, but the text doesn't update when you close the page and re-open it. Please Help if you ...

SQL Server 2000 Standard Edition vs SQL 2000 Personnel Edition
I am using SQL server 2000 standard Edition sp3 with Gp 9 Sp3, I am planning to move GP with database to new server different hardware. can I use sql 2000 personnel edition sp3 or should I use same old version. I hope u understand my question. MK KSA Generally speaking, personal editions are not robust enough to support a product like GP. I would stay away. -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tips and Tricks Newsletter and check out our books at http://www.AccoladePublications.com "MK KSA&quo...

How to remove that box/description of the receipt at the top
Hi there, When I print my receipts in RMS i get this box that says "sales receipt" under my store name/header. I'm not a big fan of this. I was wondering if I can change it to say only ONE THING "Recu Officiel" with no ugly box around it. Please let me know - thanks. Hi Nith - if you're using the receipt.xml template for your receipts, open it with Notepad and navigate to this section <!-- ============================= SUB: PrintTransactionType ============================= --> <SUB name="PrintTransactionType"> <T...

Problem related to Dialog Box in a Regular Dll?
Hi All I have created a Regular Dll that statically links with MFC. I want to have a dialog box as a part of my dll. So i insertted a dialog box & created its coressponding classes namely : CDllDialog.h & CDllDialog.cpp. Then i created 2 more .h & .cpp classes namely MyExportClass.h & MyExportClass.cpp The code for the class is as follows: class __declspec(dllexport)MyExportClass { public: BOOL Show_Image_In_ImageViewer(char* cImgFileName, DWORD dwSectorNo, DWORD dwImageSize); }; #include "stdafx.h" #include <stdio.h> #include <iostream.h> #in...

Text box "print object" becomes unchecked within a Chart
First of all, I'm not sure if I should post this question in "Charts" or "General" or another topic, but I have a workbook that has been around for a few years. It used to print fine; now text boxes w/in charts are no longer printing. The solution is going into eachText Box properties and checking "Print Object". (Unfortuantely, there are many textboxes . . . I have a question posted under programming on how to create a macro to fix this problem.) Thank you for any thoughts . . . ...

addresses in send to box
when I create a new email I click on the To box for the person I am sending the message. In this box all of my contacts have several addresses that keep building up. How do I delete duplicate addresses in this folder. Open the Contacts folder (c:\Users\yourlogin\Contacts) and delete the duplicates. -- Dave N. MS-MVP (Mail) Windows 7 Ultimate http://download.live.com/wlmail "HNZ57" <HNZ57@discussions.microsoft.com> wrote in message news:B1E56CF4-3C33-4522-821B-AD324FEA015B@microsoft.com... > when I create a new email I click on the To box for th...

editting auto recovery
Hello, is it possible to change the auto recovery directory just for one document and is also possible to ensure that the auto recovery file is not deleted after the file is closed? Cheers Hi AFAIK this is not possible. But you may consider using the following add-in: http://www.jkp-ads.com/Download.htm (look for AutoSafe.zip, not autosafeVBE.zip, for your purposes.) -- Regards Frank Kabel Frankfurt, Germany Hcoms wrote: > Hello, > > is it possible to change the auto recovery directory just for one > document and is also possible to ensure that the auto recovery file > ...

BOM & Edit List
Hi, I created an Assembly transaction and printed it from the Assembly transaction entry window before posting it. In the posting journal that prints it does not print the Assemble cost, extended assemble cost, Unit cost of the components and the extended cost. But if i post the transaction then the same posting journal is printed with the costs. Why does it not print? Please let me know Thanks Dev It only pulls posted costs, like other Great Plains edit lists including items. You will need to modify the report to include costs. "Dev" wrote: > Hi, > > I created...

template edit question, add more? edit template?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel i'm using a resume template and it's beautiful, but only allows four job positions before it moves one the education, etc. <br><br><i>guess theres a way to do it on the pc version, but with mac, how do i insert an addition formatted block? it will only let me work within the template currently.</i>&#32;<br><br><i>hope that makes sense, thanks for the help!</i> Mac or PC makes no difference � it's a matter of how the template is constructed. With...

? Both Help Box AND Minimize Box in Title Bar of MFC Dialog App
Hi, I assume that this question has been asked before but since I can't find it anywhere... How can you put both a question-mark context-sensitive help button AND a Minimize/Maximize Box in the title bar of a Dialog mode MFC app? Thanks -- Alec asoroudi@synetech.cjb.net ...

How to edit entitys attributes directly?
I messed up with entity mappings and ended up with errror: attribute not found. How can I manually remove attribute from entity? Tried export -edit -import but it seems not to be the right way. You will first need to remove the "bad" mapping that you created. Since it is referncing the field, you need to do that prior to trying to remove the field. You also need to remove it from any forms & views that may be displaying it. The customization Import will not remove fields (as you have discovered). That is done as a safety feature to rpevent accidental loss of data (ima...

Editing
Hi! Could you please tell me how to remove a linked transaction within the budget planner. For example, I have a double entry under the debt category. ...

Change number in Text Box in Excel
Need to change the number in Text Box in Excel. For example; (Text Box 209). I want to change that number to (Text Box 1). In fact I would like to sequence the Text Box numbers form 1 to 160. Can you help? You can name a textbox (created with the drawing toolbar) the same way you can name a cell. Just select it, then do what's demonstrated here: http://www.officearticles.com/excel/named_ranges_in_microsoft_excel.htm ************ Anne Troy www.OfficeArticles.com "Jerry Dyben" <Jerry Dyben@discussions.microsoft.com> wrote in message news:0E555C29-787F-4DAF-8B61-1533...

Nedd help with the simplest thing with the check box
I'm trying to do the simplest thing (and have wanted to for years) with a check box - stick it -in- a cell just so I can check or uncheck it. Of course, it will be even better if I can get the rest of the worksheet to read a 1/0 or true/false from this box; but I'm using office 2000 and it says nothing useful. I pull the box out of the form toolbar, but it's a floating object like a chart. And that's all the reference I can find in Officer 2000. Thanks in advance for any help you can give. -- Zubbus ------------------------------------------------------------------------ Z...

Macro to edit details
Hi, i am currently trying to create a macro regarding editing staf details on a worksheet....... therefore i recorded a macro and named it editstafflist, i highlighte my headings...and then went to 'data > form' and then had to close th form and then stop my macro. It wouldnt allow me to stop my macr whilst the dialogue box was open. Anyways after stopping the macro drew out a button and assigned this 'editstafflist' macro to it. saved my sheet and then clicked on the button, but a error '1004' kep occuring, can anyone please help me on this as i am rather stuck ...

editing a drop down #2
that's not one of my choices. -- kateweb ------------------------------------------------------------------------ kateweb's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=16301 View this thread: http://www.excelforum.com/showthread.php?threadid=276931 what do you mean by this .. is it greyed out on the toolbar or shows "any value"? if you'ld like to tell me where you downloaded it from i can go have a look at it cheers JulieD "kateweb" <kateweb.1fictb@excelforum-nospam.com> wrote in message news:kateweb.1fictb@excelfor...

Setting caret in edit control & activating it.
Hello Does anyone have any example code for setting and enabling the caret in an edit control ? Nicholas Take a look at the CEdit::SetSel() member function. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "Nicholas Kingsley" <nickk@nildram.co.uk> wrote in message news:3f9d418a$0$106$65c69314@mercury.nildram.net... > Hello > > Does anyone have any example code for setting and enabling the caret in an > edit control ? > > Nicholas > > If you are asking how to create & use your own caret in an edit control then check...

print box has changed in Publisher, how do get the other one back
I had the regular print box that came up in Publisher, the one with more information and you can show the picture of what is printing. It went away and I can not get it back. The print box that displays now is the normal one that shows up on everything else. What version Publisher? Are you asking about the mini-preview in the Print dialogue? -- Mary Sauer http://msauer.mvps.org/ "Judy" <Judy@discussions.microsoft.com> wrote in message news:971570E4-882A-422E-B662-9E4552640197@microsoft.com... >I had the regular print box that came up in Publisher, the one with mor...

Bug with Combo Box?
Hi, I have noticed that either on a web page or a desktop application form, Combo box always appear at the top of each control either you change the z index or not. Is that a bug with Combo box or what? Is there any way to send the combo box behind some control (button, static) ? Thanks in advance. Fahad Ashfaque fahad_ashfaque@yahoo.com Change the Z order doesn't work? "Fahad Ashfaque" <fahad_ashfaque@yahoo.com> д����Ϣ���� :05dc01c39f4d$9294cf70$a301280a@phx.gbl... > Hi, > I have noticed that either on a web page or a desktop > application for...

Data collection Form Edit
We have a form which will be used almost daily, for data collection, based on a query. During the test we found a typo in one of the field labels where a brief description is included. Is there some way to edit the form? (recreating it with all the custom lables is just too long a task). Another issue on this topic, every time the form is sent, the messge reverts to the default "Please fill out the form and retunr it to me". Can this default message be changed? Nothing in the help functions. Any advice, or deirection to a learning resource will be appreciated. Thanks is adva...

"Windows PowerShell Cookbook" by Lee Holmes second edition draft available for viewing and comments
O'Reilly Books has made the working text of the PS V2 second edition of Lee Holmes' "Windows PowerShell Cookbook" available for viewing and comments at http://powershell.labs.oreilly.com/ - Larry In message <exi7SKRyKHA.2552@TK2MSFTNGP04.phx.gbl>, Larry__Weiss <lfw@airmail.net> writes >O'Reilly Books has made the working text of the PS V2 second edition >of Lee Holmes' "Windows PowerShell Cookbook" available for viewing and >comments at > > http://powershell.labs.oreilly.com/ > > - Larry > Aw...

Having Insert button functionality while editing
Hi, I want to have the functionality of Insert button (on keyboard) in my while application while editing in a cell or a edit box. For eg if i am editing my text say "alpha" and my cursor is between "l" and "p" and I insert an alphabet say "z", i want the "p" should be replaced by "Z" and the text should become "alzha". Please suggest. Thanks in advance. Regards, Arjun CEdit does not support that by default. Here is a good example of how implement this (Although I think UpdateCaret should just be a method of CXEdi...

Pivot Charts Display Filter Box
I would like to have the filter box displayed on my pivot chart. My 2003 pivot charts no longer display the drop down box, how do I get it back? ...

Strange Message Box in Excel
Hiyall: I'm running Excel 2002 on XP Pro. I'm dealing with a workbook wherein one of the worksheets will have about 3000 rows and around 50 columns. I'm trying to apply validation (list of three possibilities from a list) and conditional formatting (background color change depending on which of the three possibilities is chosen) to 20 of the 50 columns. After I get about halfway through the formatting, when I go to save the workbook, I get the following message box: -------------------------------------------------- Excel could not save all the data and formatting you ...

How do I find where I stopped editing a document?
In Word 2003, I could use Shift F5 when I opened a document to find where I left off editing it the last time I opened it. This doesn't seem to work in Word 2007, at least not consistently. Is there some other menu item or keyboard shortcut I can use, or are there some circumstances under which Shift F5 will work? Unfortunately, it doesn't work in XML (*.docx) documents, only those saved in Word 97-2003 format. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Shortcut Jane" <Shortcut Jane@discus...