registrykey.setValue problem

Hi, I am trying to save my form's location into the registry, so I used this code:

"main ->SetValue(S"MainX", this ->Location.get_X());

main ->SetValue(S"MainY", this ->Location.get_Y());"

I then get the compiler error, "cannot convert 'int' to 'Object __gc*'"

Now, I realize that its SetValue(String*, Object*), but when I look at the MSDN info about the method, it shows examples of it storing integers, floats, etc. I am not using the .NET framework 2.0.

How can I save int's into the registry

Thanks




Answer this question

registrykey.setValue problem

  • lemonsito

    Ok, so when I retrieve it, do I just do the __box() command again to get an int data type or will it automatically be an int


  • nabeelfarid

    Then you have to box the integer value

    main ->SetValue(S"MainY", __box(this ->Location.get_Y()));



  • A.Carter

    Ok, Thanks a lot for the help!


  • sroughley

    davidguygc wrote:
    Ok, so when I retrieve it, do I just do the __box() command again to get an int data type or will it automatically be an int

    You have to do something like this:

    Int32 val = *dynamic_cast<__box Int32*>(obj);



  • registrykey.setValue problem