|
sorry for the confusion.
There is a build and execute. When i build, there is no error and no warning. but when i execute, it show me the dialog box
|
|
|
|
|
Have you single-stepped through the code to see which is the offending statement? Up until you know the statement in question, we can't be of much help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
You can also use MFC template class CArray if you've ever tried your hands on templates. All I can assure you is that its not that difficult at all.
Gurmeet BTW, can Google help me search my lost pajamas?
My Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
is there any simpler way?
|
|
|
|
|
Using a CArray (or STL vector) is far easier than trying to get the data from a database. There will be examples aplenty on codeproject
However, if you really want to use a database, what database do you have - MS Access?
You don't say whether you're using MFC or just doing straight C++. If MFC then probably the easiest method is to use the DAO classes. Though this might be an old-fashioned way of going about it these days. You could use ADO but, if I recall, MFC does not have native ADO classes - though it's still possible to use it. the point is that these methods are all somewhat more elaborate than using a database.
Kevin
|
|
|
|
|
i am using MFC but don't have to show the values out, just need to store into array and calculate an end result we i want to acheive.
so using CArray is the only solution and easiest?
|
|
|
|
|
dreamerzz wrote:
so using CArray is the only solution...
No, of course not. It's just one of many implementations. From what information you've provided, it sounds like you simply need to store the numbers in a text file. Then you could process them with something like:
CStdioFile file("", CFile::modeRead);
CString strLine;
int nSum = 0,
nLineCount = 0;
while (file.ReadString(strLine) != FALSE)
{
nSum += atoi(strLine);
nLineCount++;
}
TRACE("The sum is %d\nThe average is %f\n", nSum, (double) nSum / nLineCount);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
i am using MFC window so is there a way to retrieve directly from the database itself?
|
|
|
|
|
Yes, using the CDatabase and CRecordset classes.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
ok. I think this is also the very last ans i would get. Although i don't really know how to go abt it. but still thanks for all the help that u have given.. thanks.
|
|
|
|
|
dreamerzz wrote:
Although i don't really know how to go abt it
In one of my earlier posts, I provided a link to a "how to" article. Once you go through those steps, not just glancing over them, you'll have a working example. Here are some others:
http://www.codeproject.com/database/#ODBC
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vctutor98/html/_gs_creating_a_new_database_application.asp
http://msdn.microsoft.com/library/en-us/vctutor98/html/_gs_about_step_1.asp?frame=true
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes there is. Using the new operator. At run-time, find out the number of records, and then allocate an array long enough to hold values you want to retrieve. For example, assuming that you've 50 records, the code will look like this:
LONG lRecCount = 50; <font color=green>
double *pdblValues = new double[lRecCount + 1];
for(LONG i = 0; i < lRecCount; i++)
pdblValues[i] = <font color=green>collect value from the field here</font>;
One more thing, don't forget to delete[] pdblValue after you are finished with it.
Hope that helps,
Gurmeet BTW, can Google help me search my lost pajamas?
My Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
Hi,
I have tried out the coding that you have given me. but i dun seems to get the results also.. Anyway, thanks for the help given.
|
|
|
|
|
Can you please provide us with some code of how you are doing this. It may be that you are doing something wrong in your code.
Gurmeet BTW, can Google help me search my lost pajamas?
My Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
Gurmeet S. Kochar wrote:
double *pdblValues = new double[lRecCount + 1];
Why the extra one?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
to evry programmer,
i am developing dervice and want ot know how service detct that some user has log on into the computer.
ppls tell me abt it , i am grave need of it
thanking you whosoever help me!!!!
Alok Gupta
visit me at http://alok.stormpages.com
|
|
|
|
|
are you looking for PWLX_NOTIFICATION_INFO ?
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
helloo thank u
but pls tell how to use taht
Alok Gupta
visit me at http://alok.stormpages.com
|
|
|
|
|
Hi,
I'm trying to create a console-like control and would like to know if that has already been done?
I'll succeed eventually, but I would appreciate discussions about algorithms, performances and otherwise potential gotchas...
More specifically, I'm curious as to how I should design the back-end buffer and the repainting or partially invalidated areas.
Cheers.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
Maxime Labelle wrote:
I'm trying to create a console-like control and would like to know if that has already been done?
Not sure, but wouldn't an edit control do what you need? If not, please explain further what a console application is doing for you.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Well,
basically, I need to replicate the behaviour of the win32 "ConsoleWindowClass", but without the borders and menu. Just like a console-control child window that I can host in any parent window.
For a good description of the problem, see this google thread
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
Unfortunately, I do not know of a way of doing that. Seems like it would involve something like CreateWindow("ConsoleWindowClass", ...) , but I can't say for sure.
Depending on the specific needs you are after, an edit control can be configured to do some fairly specific things (e.g., maintain a certain size, scroll, use a fixed-spaced font).
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Right,
That's why I have undertaken the task to actually implement the grunge work in a custom window class of my own.
I already have a barely functional window, which is able to resize in integral multiples of the character width and height, and that implements scrolling in a sensible way.
I'm interested in design tips in how to handle the repainting of partially invalidated areas when scrolling text and that's why my original question was targeted to how I should design the control.
Also, I would somehow need to manipulate regions of texts in order to be able to cut and paste from and to my control, so that's why such design decisions are important.
When I will need to correctly handle the colors or each character, I will probably hit some other gotchas, etc.
Cheers.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
These CP articles may prove useful:/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
Thanks for these articles.
I will need this information in the latter part of my project, but that's not exactly what I need right now, however.
Cheers.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|