Click here to Skip to main content
13,049,684 members (66,884 online)
Rate this:
Please Sign up or sign in to vote.
Hello people all welcome. I hav started my career in windows programming.
I am doing an project in SDI. I have two functions name sendtext(CString str) and
displaytext(CString inr) both in different class.
I have a pointer name pView to send the string str to function "displaytext".
The problem is after some operations i get a text in str and i send that text to display text in the output screen i get the text and wen the second text comes to "displaytext" the former text disappears and the latest string only present. Pleae help me like how can i display both the text in the output window on ClistCtrl class.

Void sendtext(CString str)
   // do some operations
void displaytext(CString inr)
  CListCtrl &ctlsde = this->GetListCtrl();
  ctlsde.InsertColumn(1,  _T("First "),   LVCFMT_LEFT,   80);
  int nItem;
	nItem = ctlsde.InsertItem(0,  inr);
Posted 5-Apr-13 0:45am
Updated 5-Apr-13 2:33am
nv3 5-Apr-13 7:07am
I don't believe that this the code is that you are executing. It wouldn't even compile (Cstring instead of CString). And do you really want to insert an additional column each time you displaytext is called?
rexamkaruaz 5-Apr-13 8:27am
I know it is CString and not Cstring i dint do ctrl+c or ctrl+v the code i jus typed here.Nope i dont want an additional column to be inserted rather it must be like following entey.
if first display text is "Good" and second is "Bad"
i want it to be displayed like
First(Column name)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It is probably the InsertColumn call that is spoiling your game. At the second call of displaytext you insert a new column, thereby shifting the existing column to the right and out of view. That is why you don't see the first value any longer.

Place that InsertColumn call in your dialog OnInitialUpdate code. Then it should work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 5 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100