Hi guys,

I am new on this forum and I would like you to help me out regarding to the actual errors that I have got. I am using managed c++ as I have switched over from vb.net, however I need your help because I couldn't figure out the solutions for these actual codes on below which it come with the actual errors I have got.


Here it is:

array<String^> ^StrArr1 = x1->Value->ToString()->Split("");


Error: error C2664: 'cli::array<Type> ^System::String::Split(...cli::array<wchar_t,dimension> ^)' : cannot convert parameter 1 from 'const char [1]' to 'wchar_t'

Code:

value1 = (key1->GetValue("Test"));

Error: error C2440: '=' : cannot convert from 'System::Object ^' to 'System::String ^'

Code:

if (QuitMe = Microsoft::VisualBasic::MsgBoxResult::Yes)

Error: error C2451: conditional expression of type 'void' is illegal

Code:

Form2::CheckBox2::Checked = Microsoft::VisualBasic::Interaction::GetSetting(Application::ProductName, "Settings", "CheckQuit", "");

Error: error C3083: 'CheckBox3': the symbol to the left of a '::' must be a type

Code:

public ref class MENUITEMINFO {

    public:
        int cbSize;
        int fMask;
        int fType;
        int fState;
        int wID;
        int hSubMenu;
        int hbmpChecked;
        int hbmpUnchecked;
        int dwItemData;
        String ^dwTypeData;
        int cch;
    };

Error: error C3379: 'Project1::Form1::MENUITEMINFO' : a nested class cannot have an assembly access specifier as part of its declaration

Code:

Form1^ MainForm = gcnew Form1();
             if (MainForm->MenuItem1->Checked == true)
             {
                 delete this;
             }

Error: error C2065: 'Form1' : undeclared identifier

Error: error C2065: 'MainForm' : undeclared identifier

Error: error C2061: syntax error : identifier 'Form1'

Error: error C2227: left of '->MenuItem1' must point to class/struct/union/generic type

Error: error C2227: left of '->Checked' must point to class/struct/union/generic type

I have include the form1.h file in a class, but I keep getting the same errors. It is the same for this:

Code:

private: System::Void Form2_Click(Object ^eventSender, System::EventArgs ^eventArgs) {
             Form2^ myform = gcnew Form2();
              myform  ->ShowDialog(this);
    }

And it is the same that it goes for this:

Code:

if (Form2::CheckBox1->Checked == true)
             {
                 cmQuit::ShowDialog();
                 e->Cancel = true;
             }

Error: error C2227: left of '->Checked' must point to class/struct/union/generic type

Error: error2352: 'System::Windows::Forms::Form::ShowDialog' : illegal call of non-static member function


And here it's the class library code:

Code:

if (System::Windows::Forms::RighttoLeft::Yes)

Error: error C2451: conditional expression of type 'System::Windows::Forms::RightToLeft' is illegal

I have added the reference of system::Windows::Forms and the header in a class, but it doesn't help to solve it.

Please could you help me to fixed the actual codes as I am received with these actual errors? I find it difficult to correct these errors. :(

Any advance would be much appreciate.

Thanks,
Mark

This article has been dead for over six months. Start a new discussion instead.