problem with errors

This is a discussion on problem with errors within the C++ Programming forums, part of the General Programming Boards category; Hi guys, I am new on this forum and I would like you to help me out regarding to the ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    40

    problem with errors

    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:

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

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






    Code:
    Code:
    value1 = (key1->GetValue("Test"));
    Error: error C2440: '=' : cannot convert from 'System::Object ^' to 'System::String ^'



    Code:
    Code:
    if (QuitMe = Microsoft::VisualBasic::MsgBoxResult::Yes)
    Error: error C2451: conditional expression of type 'void' is illegal



    Code:
    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:
    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:
    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:
    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:
    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:
    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

  2. #2
    C++ Junkie Mozza314's Avatar
    Join Date
    Jan 2011
    Location
    Australia
    Posts
    174
    array<String^>
    What's going on with that '^' in there? You can't have '^' in your types.

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    40
    Quote Originally Posted by Mozza314 View Post
    What's going on with that '^' in there? You can't have '^' in your types.
    Thanks for your replied, so what I should use it then?

    should i use something like this?


    Code:
    array<String>


    If not then please could you show me an example that what I should use. And please could you also help me with the other methods that I need to make some changes?


    Thanks,
    Mark

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,292
    Quote Originally Posted by Mozza314 View Post
    What's going on with that '^' in there? You can't have '^' in your types.
    he's using C++/CLI - the .Net enabled version of C++ that microsoft provides. the ^ character is basically saying "this is a .Net reference type."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler program problem
    By shellback in forum C Programming
    Replies: 9
    Last Post: 03-19-2011, 03:58 AM
  2. Logical errors with if and if-else statements
    By billybob2020 in forum C Programming
    Replies: 2
    Last Post: 11-18-2010, 10:13 PM
  3. Replies: 4
    Last Post: 10-25-2010, 03:15 PM
  4. Getting illegal case error
    By scmurphy64 in forum C Programming
    Replies: 2
    Last Post: 09-17-2009, 10:35 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21