|
I don't know how to do this ...I go to Source file->add class->visual c++(c++ class)->and I create a new class and a new header like this?
#include "StdAfx.h"
#include "gt.h"
gt::gt(void)
{
}
#pragma once
ref class gt
{
public:
gt(void);
};
how can I call this function or this class in my ...StartPackingbutton:
private: System::Void StartPackingbutton_Click(System::Object^ sender, System::EventArgs^ e)
{.........?}....please help me if you know...
|
|
|
|
|
#include "gt.h"
Assuming the method is static:
gt.MyMethod(whatever);
If you don't know how to call a method in a class, I recommend buying a book on C++ and working through it.
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 )
|
|
|
|
|
Hello ,
This piece of code is meant to browse for a file , display the path and display the content , its browsing but not displaying the filepath and content , can anyone help with this?
OpenFileDialog^ fileChooser = gcnew OpenFileDialog();
try{
fileChooser->InitialDirectory = "C:\\My Documents";
}
catch( ... ){
MessageBox::Show("No C:\\ drive", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
fileChooser->DefaultExt = "*.rtf";
fileChooser->Filter ="Rich Text Format (*.rtf)|*.rtf|"
"Text Files (*.txt)|*.txt|"
"All Files (*.txt; *.rtf)|*.txt;*.rtf;";
fileChooser->FilterIndex = 1;
Windows::Forms::DialogResult result = fileChooser->ShowDialog();
if(result == System::Windows::Forms::DialogResult::OK)
return;
//get specified file name
fileName = fileChooser->FileName;
//show error is user specified invalid file name
if(fileName=="")
{
(MessageBox::Show("Invalid File name","Error!", MessageBoxButtons::OK, MessageBoxIcon::Error)); } else
{
file_richTextBox->Text ="";
ReadFileInfo(fileName);
}//end of else
}//end of browseButton_Click
try{
input = gcnew FileStream(filenam, FileMode::Open, FileAccess::Read);
FileInfo^ fInfo = gcnew FileInfo(filenam);
//Display filepath
String^ fname = fInfo->FullName;
file_textBox->Text = fname;
//Check file extension and load file info
fname = fInfo->Extension->ToLower();
if (fname->Equals(".rtf"))
file_richTextBox->LoadFile(input, RichTextBoxStreamType::RichText);
else
file_richTextBox->LoadFile(input, RichTextBoxStreamType::PlainText);
input->Close();
}
catch( ... ){
MessageBox::Show(String::Format("{0} is not a valid text file.", filenam),
"Error!", MessageBoxButtons::OK , MessageBoxIcon::Error);
}
}
d
|
|
|
|
|
Debun wrote: if(result == System::Windows::Forms::DialogResult::OK)
return;
How do you think it'll work if you return when the user clicks OK? Perhaps you meant to do a != check?
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
hi
i am writing a program using linked list and binary input/output
but i dont have any sample code for geting started with
can any one help me with sample c++ code for this program?
hari
|
|
|
|
|
If you're using C++/CLI ( and if you're not, you're in the wrong forum ), you can still use STL, and the STL list class ships with full source.
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 )
|
|
|
|
|
I was wondering how to totally take out the title bar windows uses and replace it with a new one in a program like winamp and sonic recordnow does.
|
|
|
|
|
Using .NET ?
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 )
|
|
|
|
|
Yanshof wrote: I try to use some MFC class
Odds are then high that you're not using C++/CLI. Try the Visual C++ forum.
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 )
|
|
|
|
|
Can I code in C or C++ for the Macintosh? I have borland tools. I also have Visual C++ in the Visual Studio, but have never used it. thanks, joeinorange2@aol.com
Joe Sharp
|
|
|
|
|
Why not? Apple claims a Mac does everything better than a PC, and a Mac has everything you will ever need preinstalled. By the way, you are in the wrong forum since this is the "C++/CLI" forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
You are in the wrong forum, but the answer is yes, of course. In fact, the Mac I used 6 years ago came with a highly standards compliant C++ compiler.
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 )
|
|
|
|
|
I have developed mulithreade TCP server in for Unix...but wanna do that in C++ usin OOPS concepts... please help... i mean how to do threading n all in OOPs...
extreemer
|
|
|
|
|
Is there any builtin button classes in c++? If yes than please do help me.
|
|
|
|
|
Depends. You're asking in the C++/CLI forum, in which case the answer is yes. If you mean C++, then the answer is that there is NO GUI support in C++, you need to use frameworks ( like Winforms or MFC ) to write code specific to a platform, in order to render a UI.
Sounds like you need to better phrase your question, and perhaps ask it in the Visual c++ forum.
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 )
|
|
|
|
|
|
If I have this code made in the Form.h of may project, how can i make the conection in
the main project file(.cpp) for variable "W".....please help.....can you give me a link or something like that where I can learn to do the conections between the variables from interface(form) and my algorithm(code)....
private: System::Void StartPackingbutton_Click(System::Object^ sender, System::EventArgs^ e) {
int W;//Container Width
try {
W=Convert::ToInt32(ContainerWidthtextBox->Text, CultureInfo::CurrentCulture);
}
int main()
{ int W;
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
lavi
|
|
|
|
|
is there a libary or something where i can get numbers which have like 50 digits without truncation, for a program for find prime numbers etc???
also why i'm here
***************************************************
***************************************************
i'm trying to use the .clear() with vectors but they never work
Code:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int>numbers;
int createindex = 100;
while(createindex)
{
numbers.push_back(createindex);
createindex--;
}
cout << numbers[20] << endl;
numbers.clear();
cout << numbers[20] << endl;
system("PAUSE");
return 0;
}
what am i doing wrong?
thanks i'n advanced
|
|
|
|
|
Yes, such classes exist.
I recommend asking for more information in the right forum ( this is the C++/CLI forum, you want the Visual C++ forum )
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 )
|
|
|
|
|
Can anyone help me with saving a text introduced in a text button in a different file?
|
|
|
|
|
You need to be more clear. Are you in the right forum ( are you using C++/CLI ) ? What do you mean by 'a different file' ? Assuming you're talking about a GUI control, you can ask it what it's Text value is, for C++/CLI the property is .Text.
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 )
|
|
|
|
|
HI im currently doing a proj on time capturing.... So i have a push button switch connected to the Rs232 to TTL Converter...the Rs232 in connected to the pc.. So can anybody help to give me the program to capture the time when the push button is pressed....Thanx
|
|
|
|
|
You want this code in C++/CLI, or in C++ ?
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 )
|
|
|
|
|
If I want to appeal a windows form, from another form when I push a button, what I should do? I tried this code and I have the following error: Error error C2061: syntax error : identifier 'Results'
private: System::Void ResultsButton_Click(System::Object^ sender, System::EventArgs^ e)
{
Application::Run(gcnew Results());
}
|
|
|
|
|
private: System::Void ResultsButton_Click(System::Object^ sender, System::EventArgs^ e) <br />
{<br />
Results^ resultForm = gcnew Results();<br />
resultForm->ShowDialog();<br />
} <br />
Also, you should include the form header at the top of the form:
#include "Results.h"
|
|
|
|