Link to home
Start Free TrialLog in
Avatar of cybecks
cybecksFlag for United States of America

asked on

CAn someone help me to fix these errors please?

I'm using Visual C++ 2005 and I recieved the following errors when trying to compile my program:

Medications.cpp
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(13) : error C4980: '__gc' : use of this keyword requires /clr:oldSyntax command line option
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(16) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(17) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(18) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(19) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
.\Medications.cpp(6) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
.\Medications.cpp(7) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
.\Medications.cpp(8) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
.\Medications.cpp(9) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
.\Medications.cpp(11) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
.\Medications.cpp(11) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
.\Medications.cpp(11) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
.\Medications.cpp(11) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
.\Medications.cpp(19) : error C2084: function 'Medications::Medications(void)' already has a body
        c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(22) : see previous definition of '{ctor}'
NewMeds.cpp
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(13) : error C4980: '__gc' : use of this keyword requires /clr:oldSyntax command line option
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(16) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(17) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(18) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(19) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(79) : error C2144: syntax error : 'void' should be preceded by ';'
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(79) : error C3699: '*' : cannot use this indirection on type 'System::Collections::ArrayList'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(189) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(226) : error C3699: '*' : cannot use this indirection on type 'System::Object'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(226) : error C3699: '*' : cannot use this indirection on type 'System::EventArgs'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(230) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(253) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(255) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(260) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(188) : error C3699: '*' : cannot use this indirection on type 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(188) : error C2750: 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(188) : error C2440: 'initializing' : cannot convert from 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter *' to 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(189) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(193) : error C3699: '*' : cannot use this indirection on type 'System::IO::FileStream'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(193) : error C2750: 'System::IO::FileStream' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(193) : error C2440: 'initializing' : cannot convert from 'System::IO::FileStream *' to 'System::IO::FileStream ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(194) : error C3699: '*' : cannot use this indirection on type 'System::Collections::ArrayList'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(194) : error C3699: '*' : cannot use this indirection on type 'System::Collections::ArrayList'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(198) : error C3699: '*' : cannot use this indirection on type 'Medications'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(202) : error C2065: 'lstMeds' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(202) : error C2227: left of '->Count' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(204) : error C3293: 'Item': use 'default' to access the default property (indexer) for class 'System::Collections::ArrayList'
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(205) : error C3699: '*' : cannot use this indirection on type 'System::Windows::Forms::ListViewItem'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(205) : error C2750: 'System::Windows::Forms::ListViewItem' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(205) : error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::ListViewItem *' to 'System::Windows::Forms::ListViewItem ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(206) : error C2750: 'System::Drawing::Font' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(206) : error C2664: 'System::Windows::Forms::ListViewItem::Font::set' : cannot convert parameter 1 from 'System::Drawing::Font *' to 'System::Drawing::Font ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(228) : error C2065: 'lstMed' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(228) : error C2750: 'System::Collections::ArrayList' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(229) : error C3699: '*' : cannot use this indirection on type 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(229) : error C2750: 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(229) : error C2440: 'initializing' : cannot convert from 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter *' to 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(230) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(234) : error C3699: '*' : cannot use this indirection on type 'System::IO::FileStream'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(234) : error C2750: 'System::IO::FileStream' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(234) : error C2440: 'initializing' : cannot convert from 'System::IO::FileStream *' to 'System::IO::FileStream ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(236) : error C2065: 'bcrStream' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(238) : error C2227: left of '->Close' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(241) : error C3861: 'ShowEmployees': identifier not found
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(249) : error C3699: '*' : cannot use this indirection on type 'mymeds::NewMedications'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(249) : error C2750: 'mymeds::NewMedications' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(249) : error C2440: 'initializing' : cannot convert from 'mymeds::NewMedications *' to 'mymeds::NewMedications ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(251) : error C2039: 'OK' : is not a member of 'System::Windows::Forms::Form::DialogResult'
        c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\AddMeds.h(24) : see declaration of 'System::Windows::Forms::Form::DialogResult'
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(251) : error C2065: 'OK' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(260) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(261) : error C3699: '*' : cannot use this indirection on type 'Medications'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(261) : error C2750: 'Medications' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(261) : error C2440: 'initializing' : cannot convert from 'Medications *' to 'Medications ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(268) : error C2227: left of '->Add' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(270) : error C3699: '*' : cannot use this indirection on type 'System::IO::FileStream'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(270) : error C2750: 'System::IO::FileStream' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(270) : error C2440: 'initializing' : cannot convert from 'System::IO::FileStream *' to 'System::IO::FileStream ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(271) : error C3699: '*' : cannot use this indirection on type 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(271) : error C2750: 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(271) : error C2440: 'initializing' : cannot convert from 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter *' to 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
mymeds.cpp
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(13) : error C4980: '__gc' : use of this keyword requires /clr:oldSyntax command line option
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(16) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(17) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(18) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(19) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\Medications.h(23) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(79) : error C2144: syntax error : 'void' should be preceded by ';'
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(79) : error C3699: '*' : cannot use this indirection on type 'System::Collections::ArrayList'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(189) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(226) : error C3699: '*' : cannot use this indirection on type 'System::Object'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(226) : error C3699: '*' : cannot use this indirection on type 'System::EventArgs'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(230) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(253) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(255) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(260) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(188) : error C3699: '*' : cannot use this indirection on type 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(188) : error C2750: 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(188) : error C2440: 'initializing' : cannot convert from 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter *' to 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(189) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(193) : error C3699: '*' : cannot use this indirection on type 'System::IO::FileStream'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(193) : error C2750: 'System::IO::FileStream' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(193) : error C2440: 'initializing' : cannot convert from 'System::IO::FileStream *' to 'System::IO::FileStream ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(194) : error C3699: '*' : cannot use this indirection on type 'System::Collections::ArrayList'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(194) : error C3699: '*' : cannot use this indirection on type 'System::Collections::ArrayList'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(198) : error C3699: '*' : cannot use this indirection on type 'Medications'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(202) : error C2065: 'lstMeds' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(202) : error C2227: left of '->Count' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(204) : error C3293: 'Item': use 'default' to access the default property (indexer) for class 'System::Collections::ArrayList'
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(205) : error C3699: '*' : cannot use this indirection on type 'System::Windows::Forms::ListViewItem'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(205) : error C2750: 'System::Windows::Forms::ListViewItem' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(205) : error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::ListViewItem *' to 'System::Windows::Forms::ListViewItem ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(206) : error C2750: 'System::Drawing::Font' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(206) : error C2664: 'System::Windows::Forms::ListViewItem::Font::set' : cannot convert parameter 1 from 'System::Drawing::Font *' to 'System::Drawing::Font ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(228) : error C2065: 'lstMed' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(228) : error C2750: 'System::Collections::ArrayList' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(229) : error C3699: '*' : cannot use this indirection on type 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(229) : error C2750: 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(229) : error C2440: 'initializing' : cannot convert from 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter *' to 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(230) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(234) : error C3699: '*' : cannot use this indirection on type 'System::IO::FileStream'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(234) : error C2750: 'System::IO::FileStream' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(234) : error C2440: 'initializing' : cannot convert from 'System::IO::FileStream *' to 'System::IO::FileStream ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(236) : error C2065: 'bcrStream' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(238) : error C2227: left of '->Close' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(241) : error C3861: 'ShowEmployees': identifier not found
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(249) : error C3699: '*' : cannot use this indirection on type 'mymeds::NewMedications'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(249) : error C2750: 'mymeds::NewMedications' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(249) : error C2440: 'initializing' : cannot convert from 'mymeds::NewMedications *' to 'mymeds::NewMedications ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(251) : error C2039: 'OK' : is not a member of 'System::Windows::Forms::Form::DialogResult'
        c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\AddMeds.h(24) : see declaration of 'System::Windows::Forms::Form::DialogResult'
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(251) : error C2065: 'OK' : undeclared identifier
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(260) : error C3699: '*' : cannot use this indirection on type 'System::String'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(261) : error C3699: '*' : cannot use this indirection on type 'Medications'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(261) : error C2750: 'Medications' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(261) : error C2440: 'initializing' : cannot convert from 'Medications *' to 'Medications ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(268) : error C2227: left of '->Add' must point to class/struct/union/generic type
        type is ''unknown-type''
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(270) : error C3699: '*' : cannot use this indirection on type 'System::IO::FileStream'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(270) : error C2750: 'System::IO::FileStream' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(270) : error C2440: 'initializing' : cannot convert from 'System::IO::FileStream *' to 'System::IO::FileStream ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(271) : error C3699: '*' : cannot use this indirection on type 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter'
        compiler replacing '*' with '^' to continue parsing
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(271) : error C2750: 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter' : cannot use 'new' on the reference type; use 'gcnew' instead
c:\documents and settings \my documents\visual studio 2005\projects\mymeds\mymeds\NewMeds.h(271) : error C2440: 'initializing' : cannot convert from 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter *' to 'System::Runtime::Serialization::Formatters::Soap::SoapFormatter ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
Generating Code...

Here is my code:
//Medications.cpp
#include "StdAfx.h"
#include "Medications.h"
#using <mscorlib.dll>
Medications::Medications(void)
{
      Meds = S"Unknown";
      Dosage = S"Unknown";
      Times = S"Unknown";
      Reason = S"Unknown";
}
Medications::Medications(System::String *meds, System::String *dosage, System::String *times, System::String *reason)
{
    Meds = meds;
      Dosage = dosage;
      Times = times;
      Reason = reason;
}
Medications::Medications(void)
{
}

//Medications.h
//#pragma once

//ref class Medications
//{
//public:
//      Medications(void);
//};
#pragma once

using namespace System;

[Serializable]
public __gc class Medications
{
public:
      String *Meds;
      String *Dosage;
      String *Times;
      String *Reason;

public:
      Medications(void);
      Medications(String *meds, String *dosage,
                   String *times, String *reason);
      ~Medications(void);
};


//NewMeds.h
#pragma once
#using <System.Runtime.Serialization.Formatters.Soap.dll>

#include "NewMedications.h"
#include "Medications.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Runtime::Serialization::Formatters::Soap;


namespace mymeds {

      /// <summary>
      /// Summary for NewMeds
      ///
      /// WARNING: If you change the name of this class, you will need to change the
      ///          'Resource File Name' property for the managed resource compiler tool
      ///          associated with all .resx files this class depends on.  Otherwise,
      ///          the designers will not be able to interact properly with localized
      ///          resources associated with this form.
      /// </summary>
      public ref class NewMeds : public System::Windows::Forms::Form
      {
      public:
            NewMeds(void)
            {
                  InitializeComponent();
                  //
                  //TODO: Add the constructor code here
                  //
            }

      protected:
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            ~NewMeds()
            {
                  if (components)
                  {
                        delete components;
                  }
            }
      private: System::Windows::Forms::Label^  label1;






      private: System::Windows::Forms::Button^  btnNewMedications;
      private: System::Windows::Forms::Button^  btnClose;
      private: System::Windows::Forms::ColumnHeader^  colMedications;
      private: System::Windows::Forms::ColumnHeader^  colDosage;
      private: System::Windows::Forms::ColumnHeader^  colTimesPerDay;
      private: System::Windows::Forms::ColumnHeader^  colReason;
      private: System::Windows::Forms::ColumnHeader^  colAllergies;
      private: System::Windows::Forms::ListView^  lvwMedications;
      protected:

      private:
            /// <summary>
            /// Required designer variable.
            /// </summary>
            System::ComponentModel::Container ^components;
            ArrayList *lstMedications

#pragma region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            void InitializeComponent(void)
            {
                  this->label1 = (gcnew System::Windows::Forms::Label());
                  this->btnNewMedications = (gcnew System::Windows::Forms::Button());
                  this->btnClose = (gcnew System::Windows::Forms::Button());
                  this->colMedications = (gcnew System::Windows::Forms::ColumnHeader());
                  this->colDosage = (gcnew System::Windows::Forms::ColumnHeader());
                  this->colTimesPerDay = (gcnew System::Windows::Forms::ColumnHeader());
                  this->colReason = (gcnew System::Windows::Forms::ColumnHeader());
                  this->colAllergies = (gcnew System::Windows::Forms::ColumnHeader());
                  this->lvwMedications = (gcnew System::Windows::Forms::ListView());
                  this->SuspendLayout();
                  //
                  // label1
                  //
                  this->label1->AutoSize = true;
                  this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 18, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
                        System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
                  this->label1->ForeColor = System::Drawing::Color::SlateBlue;
                  this->label1->Location = System::Drawing::Point(106, 31);
                  this->label1->Name = L"label1";
                  this->label1->Size = System::Drawing::Size(273, 29);
                  this->label1->TabIndex = 2;
                  this->label1->Text = L"My Medication Record";
                  //
                  // btnNewMedications
                  //
                  this->btnNewMedications->Location = System::Drawing::Point(197, 238);
                  this->btnNewMedications->Name = L"btnNewMedications";
                  this->btnNewMedications->Size = System::Drawing::Size(127, 23);
                  this->btnNewMedications->TabIndex = 9;
                  this->btnNewMedications->Text = L"New Medications";
                  this->btnNewMedications->UseVisualStyleBackColor = true;
                  this->btnNewMedications->Click += gcnew System::EventHandler(this, &NewMeds::btnNewMedications_Click);
                  //
                  // btnClose
                  //
                  this->btnClose->DialogResult = System::Windows::Forms::DialogResult::Cancel;
                  this->btnClose->Location = System::Drawing::Point(343, 238);
                  this->btnClose->Name = L"btnClose";
                  this->btnClose->Size = System::Drawing::Size(75, 23);
                  this->btnClose->TabIndex = 10;
                  this->btnClose->Text = L"Close";
                  this->btnClose->UseVisualStyleBackColor = true;
                  this->btnClose->Click += gcnew System::EventHandler(this, &NewMeds::btnClose_Click);
                  //
                  // colMedications
                  //
                  this->colMedications->DisplayIndex = 1;
                  this->colMedications->Text = L"Medications";
                  this->colMedications->Width = 113;
                  //
                  // colDosage
                  //
                  this->colDosage->DisplayIndex = 2;
                  this->colDosage->Text = L"Dosage";
                  this->colDosage->Width = 55;
                  //
                  // colTimesPerDay
                  //
                  this->colTimesPerDay->DisplayIndex = 3;
                  this->colTimesPerDay->Text = L"Times Per Day";
                  this->colTimesPerDay->Width = 85;
                  //
                  // colReason
                  //
                  this->colReason->DisplayIndex = 4;
                  this->colReason->Text = L"Reason";
                  this->colReason->Width = 362;
                  //
                  // colAllergies
                  //
                  this->colAllergies->DisplayIndex = 0;
                  this->colAllergies->Text = L"Allergies";
                  //
                  // lvwMedications
                  //
                  this->lvwMedications->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)
                        | System::Windows::Forms::AnchorStyles::Left)
                        | System::Windows::Forms::AnchorStyles::Right));
                  this->lvwMedications->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(5) {this->colMedications,
                        this->colDosage, this->colTimesPerDay, this->colReason, this->colAllergies});
                  this->lvwMedications->FullRowSelect = true;
                  this->lvwMedications->GridLines = true;
                  this->lvwMedications->Location = System::Drawing::Point(28, 63);
                  this->lvwMedications->Name = L"lvwMedications";
                  this->lvwMedications->Size = System::Drawing::Size(425, 148);
                  this->lvwMedications->TabIndex = 8;
                  this->lvwMedications->UseCompatibleStateImageBehavior = false;
                  this->lvwMedications->View = System::Windows::Forms::View::Details;
                  //
                  // NewMeds
                  //
                  this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                  this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                  this->ClientSize = System::Drawing::Size(481, 293);
                  this->Controls->Add(this->btnClose);
                  this->Controls->Add(this->btnNewMedications);
                  this->Controls->Add(this->lvwMedications);
                  this->Controls->Add(this->label1);
                  this->Name = L"NewMeds";
                  this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
                  this->Text = L"NewMeds";
                  this->ResumeLayout(false);
                  this->PerformLayout();

            }
            void ShowMedications(void)
                  {
       SoapFormatter *medsSoap = new SoapFormatter();
       String *strFilename = S"Medications.bcr";
                  
       if( File::Exists(strFilename) )
       {
FileStream *medsStream = new FileStream(strFilename, FileMode::Open, FileAccess::Read, FileShare::Read);
             ArrayList *lstMed = dynamic_cast<ArrayList *>(medsSoap->Deserialize(medsStream));

             medsStream->Close();

             Medications* Med;

             lvwMedications->Items->Clear();

             for(int i = 0; i < lstMeds->Count; i++)
             {
                   Med = dynamic_cast<Medications *>(lstMed->Item[i]);
                   ListViewItem *lviMedications = new ListViewItem(Med->Meds);
                   lviMedications->Font = new Drawing::Font("Georgia", 8, FontStyle::Bold);
             
                  if( i % 2 == 0 )
                   {
                         lviMedications->BackColor = Color::Blue;
                         lviMedications->ForeColor = Color::White;
                   }
                   else
                   {
                         lviMedications->BackColor = Color::LightBlue;
                         lviMedications->ForeColor = Color::Blue;
                   }

                   lviMedications->SubItems->Add(Med->Meds);
                   lviMedications->SubItems->Add(Med->Dosage);
                   lviMedications->SubItems->Add(Med->Times);
                   lvwMedications->Items->Add(lviMedications);
             }
      }
}
private: System::Void Medications_Load(System::Object *  sender, System::EventArgs *  e)
{
       lstMed = new ArrayList;
       SoapFormatter *bcrSoap = new SoapFormatter();
       String *strFilename = S"Medications.bcr";
                  
       if( File::Exists(strFilename) )
       {
FileStream *medsStream = new FileStream(strFilename, FileMode::Open, FileAccess::Read, FileShare::Read);

             lstMed = dynamic_cast<ArrayList *>(bcrSoap->Deserialize(bcrStream));

             bcrStream->Close();
       }

       ShowEmployees();
}

#pragma endregion
      private: System::Void btnNewMedications_Click(System::Object^  sender, System::EventArgs^  e)
                   {
                        // NewMedications newForm;
                 //newForm.ShowDialog();
                         NewMedications *dlgMeds = new NewMedications;
                         
       if( dlgMeds->ShowDialog() == DialogResult::OK )
       {
             if( dlgMeds->txtMeds->Text->Equals(S"") )
             {
             MessageBox::Show(S"You must provide at least a Medication name to create a new Medication");
                   return;
             }
             else
             {
                   String *strFilename = S"Medications.bcr";
                   Medications *Meds = new Medications;

                   Meds->Meds = dlgMeds->txtMeds->Text;
                   Meds->Dosage  = dlgMeds->txtDosage->Text;
                   Meds->Times     = dlgMeds->coboTimes->Text;
                   Meds->Reason    = dlgMeds->txtReason->Text;

                   lstMed->Add(Meds);
                  
 FileStream *bcrStream = new FileStream(strFilename, FileMode::OpenOrCreate, FileAccess::Write, FileShare::Write);
                   SoapFormatter *bcrSoap = new SoapFormatter();
                   bcrSoap->Serialize(bcrStream, lstMed);
                   bcrStream->Close();
                                     
                   ShowMedications();
             }
       }


                   }
private: System::Void btnClose_Click(System::Object^  sender, System::EventArgs^  e)
             {
                   Close();
             }
};
}


ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial