VB.Net Format Against C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clark Kent

    VB.Net Format Against C#

    HI!


    Any one can tell why VB.Net gives error

    Operator '*' is not defined for types 'Microsoft.Dire ctX.Matrix' and
    'Microsoft.Dire ctX.Matrix'.

    from lines that are below and in C# it works just fine?

    How ill solve this? Totally lost now.



    EXAMPLES:

    VB.Net

    Dim m As Matrix = Matrix.Translat ion(0, 0.4F, 0)

    m *= Me.TransformMat rix()

    dev.Transform.W orld = m

    C#

    Matrix m = Matrix.Translat ion(0,0.4f,0);

    m *= this.TransformM atrix();

    dev.Transform.W orld = m;


  • Herfried K. Wagner [MVP]

    #2
    Re: VB.Net Format Against C#

    Hello,

    "Clark Kent" <sontaremove-this@fcaa.fi> schrieb:[color=blue]
    > Any one can tell why VB.Net gives error
    >
    > Operator '*' is not defined for types 'Microsoft.Dire ctX.Matrix' and
    > 'Microsoft.Dire ctX.Matrix'.
    >
    > from lines that are below and in C# it works just fine?
    >
    > How ill solve this? Totally lost now.[/color]

    VB .NET doesn't support operator overloading. You may want to use the
    Multiply method of the Matrix class.

    HTH,
    Herfried K. Wagner
    --
    MVP · VB Classic, VB .NET
    Die Website von H. Wagner zu .NET, Visual Basic .NET und Classic Visual Basic.



    Comment

    • Armin Zingler

      #3
      Re: VB.Net Format Against C#

      "Clark Kent" <sontaremove-this@fcaa.fi> schrieb[color=blue]
      > Any one can tell why VB.Net gives error
      >
      > Operator '*' is not defined for types 'Microsoft.Dire ctX.Matrix'
      > and 'Microsoft.Dire ctX.Matrix'.
      >
      > from lines that are below and in C# it works just fine?
      >
      > How ill solve this? Totally lost now.[/color]

      You can't multiply matrices using the * operator. Only basic data types can
      be multiplied.

      See language specification, chapter 10.5.3:
      VB and C#
      Reference
      VB language
      VB.NET language specifications
      10. Operators
      10.5
      10.5.3


      --
      Armin


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: VB.Net Format Against C#

        Hello,

        "Tom Spink" <thomas.spink@n tlworld.com> schrieb:[color=blue]
        > I'm saving up :-)[/color]

        ;-)))

        Regards,
        Herfried K. Wagner
        --
        MVP · VB Classic, VB .NET
        Die Website von H. Wagner zu .NET, Visual Basic .NET und Classic Visual Basic.



        Comment

        Working...