|
Here is the right error message:
error C3265: cannot declare a managed 'db' in an unmanaged 'CViewerVS8_TestProjectDlg'
_____________________________
...and justice for all
APe
|
|
|
|
|
|
Heyas all,
I've added a new form to my project called ExitForm. In the main form of the project I've added #include "ExitForm.h". I'm trying to do the following:
<br />
void onSomeEvent(object^ sender, EventArgs^ e)<br />
{<br />
ExitForm^ eForm = gcnew ExitForm();<br />
eForm->ShowDialog();<br />
}<br />
I get ExitForm: undeclared identifier
Can anyone shed some light on what I'm forgetting to do to make ExitForm visible to other files in the project?
Thanks,
John
|
|
|
|
|
I don't see any problem with your code.
do you have in ExitForm.h:
public ref class ExitForm : public System::Windows::Forms::Form
or did you define namespace?
|
|
|
|
|
Yes, the form was created by visual studio, so the namespace is correct, and the form is inherited correctly.
This is driving me nuts!
Thanks,
John
|
|
|
|
|
Did you have any syntax problem in ExitForm.h?
If no then delete/remove ExitForm.h And Recreate
|
|
|
|
|
OK, I deleted all files pertaining to my form, and recreated, then deleted all precompiled headers etc. and now it works perfectly. that is rediculous. grrr
thanks a ton for your help though
Thanks,
John
|
|
|
|
|
i tried to run C++ using VS.net but it start to compile with error -- fatal error has occured, it there any other way to run normal C++. thanks
|
|
|
|
|
pete0 wrote: i tried to run C++ using VS.net
What does that mean ?? C++ is just a programming language so you cannot 'run' it. You mean you tried to compile one of your program with .NET ?
pete0 wrote: fatal error has occured
What is fatal error ?
Could you be more specific ?
|
|
|
|
|
i have a program me a troble since i am new to c++ programming before i send any over , are cool to help me.
|
|
|
|
|
i have a program troubling me. i have cracked my head at it all day but to no avail. can help
|
|
|
|
|
It would help a lot if you could give us a CLEAR explanation of your problem.
|
|
|
|
|
this program accept user input like an app-oin-tment book, at the moment can only take one date. i am just learning the programming ,it wil be great
the prog. is as follows:
#include "stdafx.h"
#using <mscorlib.dll>
using namespace std;
class Day{
private:
int day,month,year;//Date
public:
Day(int,int,int);//Constructor
~Day();//Destructor
void display();
};
Day::Day(int d,int m,int y){//Pass date to constructor
day=d;month=m;year=y;//Set the date
}
Day::~Day(){}
void Day::display(){
std::cout<<day<<' '<<month<<'="" '<<year<<std::endl;="" display="" day
=""
}
int="" main(){
="" int="" d,m,y;
="" std::cout<<"please="" input="" the="" date="" :\n";
="" std::cin="">>d>>m>>y;
Day MyDay(d,m,y);//Create a day
do{
MyDay.display();
}
}
|
|
|
|
|
sorry guys
what the programm does it suppose to take multiple date from users.
eg 12/12/2006
13/12/2006
14/12/2006
and so on.
|
|
|
|
|
First explain your problem clearly, the only thing I see here is code and a very brief description of what your program should do. But what is actually the problem ?? You have an error, a crash, ... ? If yes, what is the exact error message, ... Give more details.
Then, when you post code, please use the PRE tags to format your code correctly.
Concerning your program, what do you want to achieve by doing this ?
do{
MyDay.display();
}
There is a do without a while condition so it won't compile. Then, you want to print the date an infinite number of time ?
|
|
|
|
|
i am very sorry.
there is no error on the program at the moment but what it supposed to do is take input from users enter dates for example if you run it, the output is
12/12/2003 but i want it to accept more than one date for example
12/01/2003
13/12/2003
14/03/2003 and so on.
This is the actual code
<br />
#include "stdafx.h"<br />
<br />
#using <mscorlib.dll><br />
using namespace std;<br />
<br />
class Day{<br />
private:<br />
int day,month,year;
<br />
public:<br />
Day(int,int,int);
~Day();
<br />
void display();<br />
};<br />
<br />
Day::Day(int d,int m,int y){
day=d;month=m;year=y;
<br />
}<br />
<br />
Day::~Day(){}<br />
<br />
<br />
void Day::display(){<br />
std::cout<<day<<'/'<<month<<'/'<<year<<std::endl;
<br />
}<br />
<br />
int main(){<br />
int d,m,y;<br />
std::cout<<"Please Input the date :\n";<br />
std::cin>>d>>m>>y;<br />
Day MyDay(d,m,y);
<br />
MyDay.display();<br />
<br />
}
|
|
|
|
|
Just put a loop in yout main:
int main(){
int d,m,y;
for (int i=0;i<10;i++)
{
std::cout<<"Please Input the date :\n";
std::cin>>d>>m>>y;
Day MyDay(d,m,y);
MyDay.display();
}
}
This will allow you to enter 10 times the date.
|
|
|
|
|
this is what i made up now but it is not working
while(MyDay!=0)<br />
{<br />
cout << Day<br />
}
|
|
|
|
|
the date should be printed say 30 if it is jan,feb,march,may,july, august , oct ,dec then 31 for sept ,april ,june and nov and 28 for feb.
|
|
|
|
|
Pete,
if you really expect people to help you, then you should start expressing yourself a little more precise. I don't blame you for your lack of programming skills or understanding of the language because we have all been rookies, but with short phrases like this:
"he date should be printed say 30 if it is jan,feb,march,may,july, august , oct ,dec then 31 for sept ,april ,june and nov and 28 for feb"
you'll probably get no further assistance here. However in additon i would recommend you to read some tutorials about c++ or programming in general.
I hope this was not too harsh...
cheers Tobias
|
|
|
|
|
Run in degug mode, then you will see an exact error message, or at least run every line, then you will find what is the problem.
|
|
|
|
|
Hello there,
I'm trying to build a couple of projects automatically using a build script. In these projects there are a couple of VS.Net 2005 C++ projects with different project directory (include/library) settings. The reason why I can't just place all these directory settings together is because some libraries conflict with each other.
I'm trying to build these projects in the build script using the "devenv.exe /build ..." command. How can I change the directory settings using the "devenv.exe" command, or is there another way?
Thanks!
~Rafferty
|
|
|
|
|
hm.. no one's replying. Does this mean this is not possible?
|
|
|
|
|
Rafferty Uy wrote: hm.. no one's replying. Does this mean this is not possible?
No. It menas, nobody read it that would know the answer, or are too lazy to write it down.
ps: I don't know the answer
|
|
|
|
|
I realize that error descriptions have gotten better, but they still need to come a long way. I will post both my error message and code in hopes that someone can help me out with this, because I am lost.
error:
error C3767: 'JensonDispatch::DataOperations::DataOperations': candidate function(s) not accessible c:\documents and settings\kathy\my documents\visual studio 2005\projects\jenson dispatch\jenson dispatch\MainForm.h 24
DataOperations.cpp
<br />
#include "StdAfx.h"<br />
#include "DataOperations.h"<br />
<br />
namespace JensonDispatch<br />
{<br />
DataOperations::DataOperations(void)
{<br />
}<br />
<br />
DataOperations::~DataOperations(void)
{<br />
}<br />
<br />
int DataOperations::ConnectToDataStore(SqlConnection^ conn, String ^query)<br />
{<br />
try {<br />
SqlCommand^ sqlComm = gcnew SqlCommand(query, conn);<br />
sqlComm->ExecuteNonQuery();<br />
MessageBox::Show("Connected!");<br />
}<br />
catch (Exception^ e) {<br />
MessageBox::Show("Error!", e->ToString());<br />
}<br />
return 0;<br />
}<br />
<br />
int DataOperations::DisconnectFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
} <br />
<br />
int DataOperations::AddCallToDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::RemoveCallFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::AddCustomerToDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::RemoveCustomerFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
}<br />
DataOperations.h
<br />
#pragma once<br />
<br />
namespace JensonDispatch<br />
{<br />
using namespace System;<br />
using namespace System::Data::SqlClient;<br />
using namespace System::IO;<br />
using namespace System::Windows::Forms;<br />
<br />
public ref class DataOperations<br />
{<br />
DataOperations(void);<br />
~DataOperations(void);<br />
public: <br />
int ConnectToDataStore(SqlConnection^, String^);<br />
int DisconnectFromDataStore(SqlConnection^, String^);<br />
int AddCallToDataStore(SqlConnection^ , String^);<br />
int RemoveCallFromDataStore(SqlConnection^, String^);<br />
int AddCustomerToDataStore(SqlConnection^, String^);<br />
int RemoveCustomerFromDataStore(SqlConnection^, String^);<br />
};<br />
}<br />
MainForm.h:
<br />
#pragma once<br />
#include "DataOperations.h"<br />
<br />
namespace JensonDispatch <br />
{ <br />
using namespace System;<br />
using namespace System::ComponentModel;<br />
using namespace System::Collections;<br />
using namespace System::Windows::Forms;<br />
using namespace System::Data::SqlClient;<br />
using namespace System::Drawing;<br />
<br />
public ref class MainForm : public System::Windows::Forms::Form<br />
{<br />
public:<br />
MainForm(void)<br />
{<br />
InitializeComponent(); <br />
MainForm::AddCallRadioButton->Checked = true;<br />
MainForm::AddLookupButton->Text = "Add Call";<br />
String^ ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=""C:\\ProgramFiles\\Microsoft SQL Server\\MSSQL.\\MSSQL\\Data\\ServiceCalls.mdf"";<br />
Integrated Security=True;Connect Timeout=30;User Instance=True";<br />
SqlConnection^ SqlConn = gcnew SqlConnection(ConnectionString);<br />
String^ QueryString = "";<br />
DataOperations^ dOps = gcnew DataOperations();
<br />
dOps->ConnectToDataStore(SqlConn, QueryString);<br />
}<br />
<br />
protected:<br />
~MainForm()<br />
{<br />
if (components) {<br />
delete components;<br />
}<br />
}<br />
#pragma region MainForm Components<br />
#pragma endregion<br />
#pragma region Windows Form Designer generated code<br />
#pragma endregion<br />
<br />
private: System::Void AddCallRadioButton_CheckedChanged(System::Object^ sender, <br />
System::EventArgs^ e) {<br />
if (MainForm::AddCallRadioButton->Checked)<br />
MainForm::AddLookupButton->Text = "Add Call";<br />
if (MainForm::LookupRadioButton->Checked)<br />
MainForm::AddLookupButton->Text = "Search";<br />
}<br />
};<br />
}<br />
Also, if anyone sees that I'm doing something blatently wrong or has contructive criticism, please by all means let me have it
Thanks,
John
|
|
|
|
|