Hello Experts ! Problem in inserting items in one CListCtrl based on another CLisTCtrl

Hello Experts and ALiR,

I have 2 ClistCtrls and both are sublassed
CMyListCtrlOne and
CMyListCtrlTwo.

In the CFromView ,I am initilaizing the column ,width and also add
items for CMyListCtrlOne
and for the CMyListCtrlTwo I am I am initilaizing the column ,width
only.
and When I click any item related to  CMyListCtrlOne ,in the OnClcik
handler I get the row and data.

Now I want  to add this data in the second list CMyListCtrlTwo

Here is the code.....Tell me where I am going wrong.

After running this app I get a debug assertion

file name:afxcmn.inl
line no:142

Thanks in advance
Tom


In CFormView.cpp
---------------------------
void CMCView::OnInitialUpdate()
{

	CFormView::OnInitialUpdate();

	GetParentFrame()->RecalcLayout();
	m_myListCtrl.SetExtendedStyle( LVS_EX_FULLROWSELECT);

	CString buffer[4][3] = {
		"Item1","kp","30",
		"Item2","sp","20",
		"Item3","dp","40",
		"Item4","lp","50"
	};


//	ResizeParentToFit();

//First CListCtrl1
	m_myListCtrl.InsertColumn(0, "Column 1");
	m_myListCtrl.InsertColumn(1, "Column 2");
                 m_myListCtrl.InsertColumn(2, "Column 3");

            m_myListCtrl.SetColumnWidth(0, 100);
    m_myListCtrl.SetColumnWidth(1, 100);
    m_myListCtrl.SetColumnWidth(2, 100);

//Second CListCtrl1
	m_myListSeriesCtrl.InsertColumn(0, "Column 11");
	m_myListSeriesCtrl.InsertColumn(1, "Column 22");
              m_myListSeriesCtrl.InsertColumn(2, "Column 33");

    m_myListSeriesCtrl.SetColumnWidth(0, 100);
    m_myListSeriesCtrl.SetColumnWidth(1, 100);
    m_myListSeriesCtrl.SetColumnWidth(2, 100);


CString strText;
int nColumnCount = m_myListCtrl.GetHeaderCtrl()->GetItemCount();

// Insert 10 items in the list view control.
for (int i=0;i < 10;i++)
{
   strText.Format(TEXT("item %d"), i);

   // Insert the item, select every other item.
   m_myListCtrl.InsertItem(
      LVIF_TEXT|LVIF_STATE, i, strText,
      (i%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED,
      0, 0);

   // Initialize the text of the subitems.
   for (int j=1;j < nColumnCount;j++)
   {
      strText.Format(TEXT("sub-item %d %d"), i, j);
      m_myListCtrl.SetItemText(i, j, strText);
   }
}

}



In First CListCtrl1 onClick()
void CMyListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
	// TODO: Add your control notification handler code here
//	AfxMessageBox("CMyListCtrl:: OnClick");
	CString strMessage;

	*pResult = 0;
	int nRow = GetNextItem(-1, LVNI_SELECTED);
	strMessage.Format("Row selected is % d ",nRow +1);
	AfxMessageBox(strMessage);
	CString ItemData1= GetItemText(nRow,0);
	//AfxMessageBox(ItemData1);
	CString ItemData2= GetItemText(nRow,1);
	//AfxMessageBox(ItemData2);
	CString ItemData3= GetItemText(nRow,2);

	AfxMessageBox(ItemData1 + ItemData2 + ItemData3);

//Adding items in the second list control
	m_myListSeriesCtrl.InsertItem(0,"1234");
	m_myListSeriesCtrl.SetItemText(0, 1, "12341");
	m_myListSeriesCtrl.SetItemText(0, 2, "12341");

}

0
nicetom786 (68)
5/11/2006 10:19:39 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
581 Views

Similar Articles

[PageSpeed] 54

Reply:

Similar Artilces:

Hello again!
I attempted to add the SW_HIDE and SW_SHOW to the app accordingly, however it did not hide the form/window.I am using Visual C++ .NET 2003 right now, and can someone email a project that uses the ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW), to my email address which is straightwaytek at homail dot com What are you trying to hide? Is it MDI or SDI? For MDI, if you want to hide the view, you will need to hide the parent frame. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "James Simpson" <straightwaytek@hotmail.com> wrote in message news:0d8001c39201$e5462d30$a101280a@p...

cell calculation problem
I need to perform a calculation on a cell, that is dependant on the text value in another cell. Its easy to do as part of visual basic. But can do the same as part of a cell calculation ?? Something like, If cell A1 = "abc" then cell A2 = cell a12 * 1.05 Try the following in cell A2. =IF(A1="abc",A12*1.05,FALSE) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "hamstring" <agent@agent.com> wrote in message news:u9lgj1hkmmi09e5js2aq07qe9k2sejmqaj@4ax.com... >I need to perform a calculation on...

CDialog::Create Problems
I am writing an MFC dll program to be used as a plugin for a C application. I need for my program to open up a new dialog box for user input based on user interaction in the host application. The end user clicks a button in the host app, to which I've assigned a callback function. The function gets called properly, and that function looks like the following: if (!strcmp((char *)userData, "Show a Dialog")){ theApp.PopDialog(); } When debugging, I can see that the PopDialog function gets fired properly. void CpluginApp::PopDialog(void) { AFX_MANAGE_STATE(AfxGetStat...

Question about ho to insert data in SQL
Hello I have a adodb recordset which always have 2000 records The code is like this 'fisrt i'm opening the database in which i will insert the data conn.ConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=MyDate;Integrated Security=True" cmd = New SqlCommand("select * from table", conn) conn.Open() 'Then i'm opening a ADODB recordset rst.Open("http://www.domain.gr/data.asp") 'the rst filled with 2000 records 'now i want to insert them to the sql database 'i'm using While Not rst.EOF dim Ins as...

CRM Mobile Registration problem
Hi Wondering if someone can help? I have installed CRM Mobile on a SBS 2003 server running CRM using my own certification authority. Followed the instructions and everything seemed to go ok until I try to register the mobile device. It just sits there with the message "Please wait while CRM mobile complete the registration process" but never goes any further. The CRMMobileErrorlog repeats the following error. [TIM]09/18/2004 08:42:23 [CMP]rdaMsgBusErrorTrace [LVL]0 [EVT]0 [TXT]Exception details : Message : Could not find resource assembly Exception Contents : System.N...

problem converting
I recently purchased Money 2004 Deluxe in order to upgrade from Money 2001. When I installed the program, it said something about the anti-virus program and refers me to the more info section, which contained no information. After installing, I open the program and it begins to convert my data andthen i receive an error message and the program closes. Any suggestions would be helpful. will this also solve the file conversion problem? >-----Original Message----- >In microsoft.public.money, Nicpalos wrote: > >>I recently purchased Money 2004 Deluxe in order to upgrade &g...

problems with creating activex control
Hi I don'y know what but something seems to be really strange in creating activeX control using MFC. First I create new ActiveX project using wizzard (with default settings). As I created new project, I reveal Class View Tree, go to LIB node and choose AddProperty. Then I Add few properties (with get/set methods), build - everything works fine, I can see everything in properties and I can access methods at run-time. Then I re-open project and add another property and build - this time property is visible in properies sheet but I can't access any of it's methods (get/set). A...

LOOKUP problem
I am trying to help my son produce a spreadsheet which will impress his lecturers at college. The LOOKUP function seems perfect for one task. On my laptop the function =LOOKUP(B31,{"Plaster","Curtains","Carpet","Glass","Wood Panels","Acoustic Tiling","Plasterboard","Brick","Acoustic Foam","Glass Window","Wood Door"}, {0.01,0.07,0.02,0.35,0.3,0.09,0.29,0.03,0.24,0.35,0.3}) Seems to work fine. It looks for the word in cell B31 and gives a value in its place. However, on his c...

SB_THUMBTRACK Problem
Hi guys, I'm having a problem. Here is code: // my override for the CWnd-derived class void CTileMapWnd::OnVScroll(UINT nSBCode,UINT nPos,CScrollBar* pScrollBar) { // skipped the other nSBCodes for this example BOOL bRedraw=FALSE; if(nSBCode == SB_THUMBTRACK){ m_curPos=(int)nPos; bRedraw=TRUE; } // redraw if(bRedraw){ SetScrollPos(SB_VERT,m_curPos); Invalidate(); UpdateWindow(); } // extra question: do I gotta call this ? // CWnd::OnVScroll(nSBCode,nPos,pScrollBar); } Alright, the problem happens when nPos hits that 32,000~ integer maximum value. But in Win 32 are...

Login Problem
I have successfully installed CRM and try to browse to the application. I receive an error Server Error in '/' Application. ----------------------------------------------------------- --------------------- Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ApplicationException: Access is denied. Source Error: An unhandled exception was generated during the execution of the current ...

Cash Flow Forcast Problem
I am recently getting the following error in Money 2004. When I click Cash Flow it says, Please create at least one checking, savings, or cash account before you go to the cash flow forecast. But when I am in an account register it still shows the 60 day forcast. ...

hello
hello, this is my first post. I have the dmeo of Microsoft retail management sofwtare and so far I like it. I run a retail store which sells all items under $2.00. we use around 40 to 50 suppliers. Basically all i want to do is be able to select a supplier from a list. see all the items they supply to we buy from that supplier. pick the items id like. place a purchase order. and when we recieve delivery recieve that purchase order and record my payment method. So far Microsft Retail Management POS has provided that for me. but the problem is for everythinbg to work i actually need to ...

Excel 2000
Starting this morning, when a user opens many (maybe all) the files on our file server in her My Docs folder, she gets a message the file is locked for editing. The only solution is to save the file in a new location, go back to the My Docs folder and delete the file and move the file from the new location. It won't let me save over the existing file. We're also getting an file system error which creates the file with in.2 as an extension. Has anyone seen this? The PC was restarted several times, I cleared out the Temp folder. Any ideas? Thanks, Diane We get this on our Networ...

CEdit problem
Hi experts, I m preparing Excel kind of thing using SDI application. I m using CEdit object for entering text. I have kept the size of CEdit as the size of my cell(D5 etc..) What i see is that inside my edit Box the text are displayed in bold letters. I dont want this. Moreever after reaching the limit of edit box i should dynamically increase the edit box's size while typing, as needed. See Microsoft Office Excel 2007 (Beta) for further checking.. Can any one of u guide me to how to do this???? Thanks To get rid of bold font, you should change the font to whatever you want(use SetFont)...

bank online update problems
Hi, I just upgraded to Money2007 and moved to the US. I was able to successfully add new bank account, Washington Mutual, from the list. However when I tried to setup the online services I get an error saying: "This account uses a different default currency than these statements. To add statements, go to this account's settings page, be sure it uses Advanced Register, change the default currency, and then provide your sign-in information again." I checked the account and indeed it was in Philippine Peso but I made the changes. I did everything it asked me to do but I keep on ...

hello
hello! ...

DrillThrough to another report
Hi, Using RS2008. I have created a report which when run will give the user an option to click on any of the report items to go to another report with more detail. When using the Visual Studio Report Designer the link to another report works absolutely 100%. It passes all the parameters required. As soon I deploy the reports to the Report Server, the link does not work. Nothing happens at all. The screen shows the areas which are clickable, but when clicking, nothing happens.... any ideas? I have never seen or heard of this happening. Are you jumping to a report in the sam...

'Personal Folders' was not closed properly. The file is being checked for problems.
I recently switched from Outlook Express 6 to Outlook 2003. When I open Outlook I get this message: "The data file 'Personal Folders' was not closed properly. The file is being checked for problems." It then takes about 10 minutes to check all of the data before Outlook will load. What's causing this problem and how can I fix it? I have about 8GB of emails that were imported over from Outlook Express. Is this huge number of emails the cause of the problem? I like to be able search out old emails and I prefer to keep them if possible. Any help would be greatly appr...

transparent window problem
Hi! I'm implementing a transparent view in an MDI application. I cannot use region or layer because the view has to be draggable by its content (using region or layer will cause mouse messages in the transparent region to fall through to the underlying window). What I did was: 1. make the child frame transparent (WS_EX_TRANSPARENT). 2. override view's OnEraseBkgnd to simply return TRUE. 3. draw something transparent in view. 4. do this in child frame's OnMove: void CChildFrame::OnMove(int x, int y) { CMDIChildWnd::OnMove(x, y); CView* view = GetActiveView(); if (view &...

restore problem
I have very small operatin here. I am backing up Information store\first storage group to HDD of another computer using windows backup program. Backup report, show how many files have been backed up. But when i use Restore operation, there is a picture of yellow folder and Question mark in fornt of "server\microsoft Information Store\first storage group" which I want to restore. It will allow me to select, but if i try to expand it by clicking on a plus sign, it will ask me to give catalog backup file name. Once I give the file name , "Server\Microsoft Informatin store\first...

Invoice Designer problem
This is a multi-part message in MIME format. ------=_NextPart_000_01B2_01C9E904.A4330D80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable When I go to Invoice Designer I get a message "Component dhtmled.ocx or = one of its dependencies is not correctly registered; a file is missing = or invalid. I am running Money '05 Small Business on a new Vista laptop. Thanks. --=20 William L. Wesselink, DC, FACO Tucson, AZ Notice of Confidentiality: The information included and/or attached in = this electronic mail transmission may con...

Member already exists problem
Hello, I'm having a problem with a database where I get the member already exists issue that has been talked about in other posts. I have <REM> out the code and it still gets me the error so its probably an issue with the sub naming, but I am at my wits end with this. I have changed the name of the combo box, Deleted the procedure and re-entered it again, made sure that it said events procedure in the box, have done a search for similarly named subs and only found the one that is giving me the error. My code is as follows, but like i said i have disabled the code with just the cli...

How do I set my sent items folder so that it doesn't delete mails.
Currently my outlook deletes sent items automativcally. I want to set it up so that it never delete any of the sent items. Thanks, -Ajay "Ajay Patel" <Ajay Patel@discussions.microsoft.com> wrote in message news:16684B53-C258-4A87-A5D6-23EB256C1E5F@microsoft.com... > Currently my outlook deletes sent items automativcally. I want to set it > up > so that it never delete any of the sent items. > How do you mean "deletes" them? are you using mcafee? I understand it will clean up old mail for users. -- Diane Poremsky [MVP - Outlook] Need Help with C...

Problems with CDialog
Hello! I have an application that uses 2 monitors. In one monitor i show some videos and in the other monitor i show the user interface. When I try to open the dialog this cannot be seen and i have to press alt+tab keys so the windows appears. If i create de dialog in this way: MyDialog md; md.Create(IID_MYDIALOG,AfxGetMainWnd()); md.Show(1); The dialog work prefectly and it can be shown without any problem, but if i try to show it as a modal dialog i hava an assert exception. md.Create(IID_MYDIALOG,AfxGetMainWnd()); md.DoModal(); Is there any way to resolve it? Thank you very much...

ProperCase problem
Hi! I have a problem with ProperCase. My code is following: Public Function Aa(strToChange As String) As String Aa = StrConv(strToChange, vbProperCase) End Function This works properly with text in the text box but with no text the result is #Error. Is there another way to convert text? Thanks for advance Birgit -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200802/1 If I understand you correctly, the problem is with blank or null textboxes. Try using this: Public Function Aa(strToChange As String) As String Aa = StrConv(nz(st...