Click here to Skip to main content
15,879,326 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: beginthread error Pin
Mark Salsbery10-Jan-07 14:01
Mark Salsbery10-Jan-07 14:01 
GeneralRe: beginthread error Pin
Mark Salsbery10-Jan-07 14:08
Mark Salsbery10-Jan-07 14:08 
Question"Failed to load toolbox item..." [modified] Pin
Xpnctoc9-Jan-07 17:03
Xpnctoc9-Jan-07 17:03 
AnswerRe: "Failed to load toolbox item..." Pin
bsaksida10-Jan-07 9:58
bsaksida10-Jan-07 9:58 
GeneralRe: "Failed to load toolbox item..." Pin
Xpnctoc11-Jan-07 5:28
Xpnctoc11-Jan-07 5:28 
GeneralRe: "Failed to load toolbox item..." Pin
Xpnctoc11-Jan-07 15:48
Xpnctoc11-Jan-07 15:48 
GeneralRe: "Failed to load toolbox item..." Pin
bsaksida11-Jan-07 21:06
bsaksida11-Jan-07 21:06 
Questionstatic const from MC++ to C# via DLL [modified] Pin
ShermansLagoon7-Jan-07 23:03
ShermansLagoon7-Jan-07 23:03 
I have two projects, one "Visual C++/CLR/Class Library" (DLL file) and one "Visual C#/Windows Application"

The DLL file:
namespace Foo<br />
{<br />
  // first attempt<br />
  public ref class RC<br />
  {<br />
    public:<br />
      static const System::Int16 value = 0;<br />
  };<br />
<br />
  // second attempt<br />
  public enum class EC : System::Int16<br />
  {<br />
    value = 0;<br />
  };<br />
}


In the application I have the following problem:
static class Program {<br />
  static void Main()<br />
  {<br />
    Int16 sh = Foo.EC.value;  // error CS0266; must use explicit type cast<br />
    switch(sh)<br />
    {<br />
      case Foo.RC.value:      // error CS0150; the value is not constant<br />
        MessageBox.Show("Information");<br />
        break;<br />
    }<br />
    return 0;<br />
  }<br />


I need to solve one of these problems (which one is not that important), i.e. to have implicit type casting from an enumeration to a short (or other type of integer), or to get a "static const" defined in MC++ to actually be a constant value.
I have looked all over the net trying to find a solution for this, but it seems that this behaviour actually is what is intended, is it really so?

Forgot to add, I am using VS 2005, i.e. .NET 2.0

-- modified at 5:37 Monday 8th January, 2007

Internet - the worlds biggest dictionary
AnswerRe: static const from MC++ to C# via DLL Pin
User 5838528-Jan-07 12:17
User 5838528-Jan-07 12:17 
GeneralRe: static const from MC++ to C# via DLL Pin
ShermansLagoon8-Jan-07 20:53
ShermansLagoon8-Jan-07 20:53 
AnswerRe: static const from MC++ to C# via DLL Pin
led mike9-Jan-07 5:39
led mike9-Jan-07 5:39 
GeneralRe: static const from MC++ to C# via DLL Pin
ShermansLagoon11-Jan-07 21:58
ShermansLagoon11-Jan-07 21:58 
GeneralRe: static const from MC++ to C# via DLL Pin
led mike12-Jan-07 4:57
led mike12-Jan-07 4:57 
GeneralRe: static const from MC++ to C# via DLL Pin
ShermansLagoon12-Jan-07 5:55
ShermansLagoon12-Jan-07 5:55 
GeneralRe: static const from MC++ to C# via DLL Pin
led mike12-Jan-07 7:12
led mike12-Jan-07 7:12 
GeneralRe: static const from MC++ to C# via DLL Pin
ShermansLagoon12-Jan-07 20:44
ShermansLagoon12-Jan-07 20:44 
AnswerRe: static const from MC++ to C# via DLL Pin
ShermansLagoon26-Mar-07 0:47
ShermansLagoon26-Mar-07 0:47 
QuestionHow can i use time ? Pin
Banks K7-Jan-07 23:02
Banks K7-Jan-07 23:02 
GeneralRe: How can i use time ? Pin
ShermansLagoon7-Jan-07 23:05
ShermansLagoon7-Jan-07 23:05 
AnswerRe: How can i use time ? Pin
Christian Graus8-Jan-07 9:39
protectorChristian Graus8-Jan-07 9:39 
QuestionHow to execute a function at schedule time? Pin
Banks K7-Jan-07 21:46
Banks K7-Jan-07 21:46 
AnswerRe: How to execute a function at schedule time? Pin
Christian Graus8-Jan-07 9:40
protectorChristian Graus8-Jan-07 9:40 
QuestionHelp with C++ Pin
Member 36662707-Jan-07 11:03
Member 36662707-Jan-07 11:03 
AnswerRe: Help with C++ Pin
Christian Graus7-Jan-07 15:21
protectorChristian Graus7-Jan-07 15:21 
GeneralRe: Help with C++ Pin
Jun Du8-Jan-07 14:03
Jun Du8-Jan-07 14:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.