|
Hi Nokoff
Why don't you use Insert->Resourses->Dialog to create a dialog? I don't have much experience of Window forms as you have created.
Good luck
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
I think you need to read some books on C++ programing. This is something quite basic: you are calling a function from a class but you don't have an instance of this class. You try to call a function directly. This only works if the function is static (that means shared across all instances of the class).
|
|
|
|
|
Oooops!
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel, I don't even see an Insert-> in VC++ 2005.
|
|
|
|
|
Cedric, I've read quite some books on it but mostly the coding was all for VC++ 6 and I can't quite understand how to implement it in VC++ 2005 Express. Sorry if I'm being too n00bish, I was just looking for an honest answer.
|
|
|
|
|
Nokoff wrote: the coding was all for VC++ 6 and I can't quite understand how to implement it in VC++ 2005 Express
This is not related to the environment you are using but really to the C++ language itself. Maybe it would be good if you learn C++ firsts and then go through MFC (through visual C++). It will help you a lot to understand how everything works. But of course, this take time
Nokoff wrote: Sorry if I'm being too n00bish, I was just looking for an honest answer
I didn't want my post to be aggressive at all. Sorry if you understood it like that.
Anyway, I gave you an answer to the problem but if you don't know what a class is and how to use it (from what you posted, it looked like that, maybe it is not the case), this will be really difficult to help you.
|
|
|
|
|
Fair enough. I'll go do some more reading. Thank you for your time
|
|
|
|
|
I've been struggling with this for a while. I'm hoping someone can help.
Let's say I have a standard set of commands, namely, to write all changes to a text file. Now I want to repeatedly implement this block of code in my program without having to copy and paste the entire block of code. How can this be done?
This is an example of the code
StreamWriter^ rewrite = gcnew StreamWriter(file_path);
for (int i=0; i < listView1->Items->Count; i++)
{
rewrite->Write(listView1->Items[i]->Text);
String^ price = listView1->Items[i]->SubItems[1]->Text->Remove(0,2);
rewrite->Write(" ["+price+"]");
rewrite->WriteLine(" #"+listView1->Items[i]->SubItems[2]->Text+"##");
}
rewrite->Close();
Is it possible to store it in a dll file and call it from the code? Is it possible to store this code in another form or resource in the current project and call it as a function? How would I go about doing that?
If at all possible, take me through it slow, I'd really like to understand this concept.
Thank You for your time
Nokoff
|
|
|
|
|
Errr...
Why don't you use a function ? I don't really see what you want to do by using that in a dll.
|
|
|
|
|
I was hoping to find out how to declare the function in another c++ file or header and reference to it from the main form to make things a bit neater.
|
|
|
|
|
Declare the function prototype (which is just the return value, the function name and its parameter, with a ';' after it) in a header file (.h) and put the definition in a source file (.cpp).
Then include the header file in the .cpp file in which you want to use the function.
Again, this is basic stuff and you should first learn the basics. Again, don't take it bad, that is not my intention to offend you, but just to give you some suggestions.
Hope this helps.
|
|
|
|
|
Everything looks ok but now it doesn't pick up any of the objects used in the main form. In my function definition, it throws errors that there are undeclared identifiers (namely, all of the objects stated). I've added all the includes in all the files. What could be wrong?
-- modified at 15:07 Thursday 13th April, 2006
|
|
|
|
|
Hi there, I need some help pertaining to a text file I'm using. No use explaining now, I'll do it as I go along.
Here is an example of my text file:
Sasko Sam Seedloaf 800gr [6.86] #3##<br />
Elite Gouda Cheese 500gr [32.90] #5##<br />
Wholegrain [5.00] #6##<br />
Wholewheat [6.00] #7##<br />
Coke [7.00] #0##
If i break it down, using the first line as an example, each line contains:
A product: "Sasko Sam Seedloaf 800gr"
A price: "6.86"
A quantity "3".
I am using a groupbox, with all the product names loaded into it so I have the string to search for. I want to modify the quantity value.
So for example, I need to be able to search through the text file, to find "Wholegrain", which in this case is on the 3rd line. And change the quantity value from '6' to '4'. Any ideas on how to do this?
I have so far,
StreamReader^ din = File::OpenText(file_path);
<br />
String^ all_text = din->ReadToEnd();
<br />
int place_holder = all_text->IndexOf(products_in_stock->Text)
Any help would be much appreciated
Thank you
Nokoff
|
|
|
|
|
|
But this code is accepted and executed in VC++ is it not? If not, how would I go about doing something like this in VC++?
|
|
|
|
|
Managed C++ is a microsoft product (targetted for .NET framework), ,so, of course it compiles with VC++, but i'd say more, it compiles only with VC++ !!!
but the fact is that MC++ is a pretty different language, even thoug it is based on the C++ syntax at its beginning, codeproject has 2 different forums, one for C++, VC++, MFC, and all that unmanaged stuff, and another for MC++, C++/CLI...
hope you better understand what i mean now.
|
|
|
|
|
Thanks for the info. Should I just post again in the correct forum or can someone not just move this post?
|
|
|
|
|
you better repost it on the correct place
|
|
|
|
|
every employee in a company reports to 1 person above him. The leader's cost of company is equal to his salary plus the cost of comapny of all his subordinates. write a program to find the cost of company of each employee. A program in a either C/C++/Java. Plz help me
Sat Shri Akal
Harsimran Singh Bhatia
|
|
|
|
|
Is it an assignment for me??
|
|
|
|
|
Thank You for your prompt reply. This is a question which has made me mad. Can U find the solution or atleast give me some hint of it. Please try it out. This is one of the questions of a company's placement paper.
Sat Shri Akal
Harsimran Singh
|
|
|
|
|
learn the forum's guidelines[^] first... we do not do homeworks here
|
|
|
|
|
Home-Works !!!!! Sir, this question is rated as one of the good questions !!! I dont ask U to do this but just ask to think over it and give hints. Sorry for asking !!!! Bye !!
|
|
|
|
|
First hint:
Start by yourslef and when you are stuck, ask specific questions.
Otherwise how do we know where you are stuck ? What is the problem ?
|
|
|
|
|