|
Bravoone_2006 wrote: int nSum = 0;
for( int nRow = 0; nRow < m_list1.GetItemCount();nRow++)
{
for( int nColumn = 0; nColumn < 3;nColumn++)
{
csText = m_list1.GetItemText(nRow ,nColumn );
nSum += atoi( csText);
}
}
int nSum = 0;
for( int nRow = 0; nRow < m_list1.GetItemCount();nRow++)
{
csText = m_list1.GetItemText( nRow, 2 );
nSum += atoi( csText);
}
|
|
|
|
|
And how would your code know which item is checked
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
OK, but it works for col 2 but I WANT to select witch rows to sum
HOW? i have try this but it sum all rows in column 2!
:
CString csText;
for(int i=0; i<m_list1.getitemcount();i++)
{
="" if(m_list1.getcheck(i))
="" {
int="" nsum="0;
for(" int="" nrow="0;" <="" m_list1.getitemcount();nrow++)
{=""
cstext="m_list1.GetItemText(" nrow,="" 2="" );=""
nsum="" +="atoi(" cstext);
}
cstext.format("%d",="" nsum);=""
m_sum.setwindowtext(cstext);=""
="" }
="" }
how="" can="" i="" sum="" only="" that="" rows="" have="" select="" ?=""
<div="" class="ForumSig">Bravoone
|
|
|
|
|
Hi Bravoone,
Try pasting this code in the first for loop
int nSum = 0;
for( int nRow = 0; nRow < m_list1.GetItemCount();nRow++)
{
for( int nColumn = 0; nColumn < 3;nColumn++)
{
if(m_list1.GetCheck(/*index of item*/nRow))
{
csText = m_list1.GetItemText(nRow ,nColumn );
nSum += atoi( csText);
}
}
// Rest of the code.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
ok but :
error C2065: 'nColumn' : undeclared identifier
its not right !something is wrong !
what ?
Bravoone
|
|
|
|
|
Bravoone_2006 wrote: error C2065: 'nColumn' : undeclared identifier
its not right !something is wrong !
what ?
Are you kidding ? I think the erro message is pretty clear no ? You are using nColumn in your code and it has not been declared anywhere. BTW, when somebody gives you code snippet, it is always better to try to understand what it does so that next time you can do it yourself, instead of blindly copy/pasting into your own code.
If you tried to do that, maybe with all the answer you got you would probably have had a working solution. Don't expect people to do everything for you.
|
|
|
|
|
THANKS GUYS !
EVERYTING IS OK !
THANKS !
Bravoone
|
|
|
|
|
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hi all,
how can i replace a string in file with my own string. for example, i open a file and search string %Pankaj% and replace with them c:\windows\system.i'm new to VC++.
thanks in advance......
Pankaj Jain
|
|
|
|
|
|
Is there a way to build a static library that could be used on both Windows & linux OS?
|
|
|
|
|
you mean something like ACE[^] library?
nave
|
|
|
|
|
|
No, the way it is done generally is that the same code is compiled with two different compilers: one for windows (and it produces a .lib file) and one for linux (it produces an .a file if I remember correctly). You cannot use the same library under windows and linux, because a library contains object code which is not portable.
|
|
|
|
|
Thanks for the quick reply Cédric. [ ]
|
|
|
|
|
You're welcome.
BTW, if you want to compile both for windows and linux (the way I described in my first answer), your code shouldn't use any platform dependant API (like MFC or WIN32 API). But cross-platform solutions exist, like for example ACE (as already said by Naveen) or wxWidgets[^] (something very similar to MFC but cross-platform).
|
|
|
|
|
Yes Cedric, I have taken care not to include any platform dependent code inside the code. Now I just need to build and link the code to diffenent runtimes on respective platforms.
|
|
|
|
|
i want to paste an icon as like inserting breakpoints in vc++.i tried bitmapbutton,pasteicon in static but nothing is efficient..infact if i give a cmd it should remove that icon also..
|
|
|
|
|
What do you mean by "paste"? Draw it on a window?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
any idea on how can the normally blue color of title bars can be changed.
|
|
|
|
|
Use SetSysColors() with COLOR_GRADIENTACTIVECAPTION and COLOR_ACTIVECAPTION .
|
|
|
|
|
Won't the use of SetSysColor() set the color of the title bars across the OS? If affirmative, this doesn't seem to be a good idea.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
How Can I Access And Read Data From Sound Card With Line In Port In Visual C++?
|
|
|
|
|
By Using Direct Show. Search The Site For Articles On How To Do This.
Man, that stuff is hard on the eyes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|