Click here to Skip to main content
14,170,500 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I converted VB.net code to C# code on a website:

Vb.net code:
Private Enum TRACKMOUSEEVENT_FLAGS
    TME_HOVER = &H1&
End Enum


Converted result (C# code):

private enum TRACKMOUSEEVENT_FLAGS
        {
            TME_HOVER = 0x1L
        }


When i build it, i get an error: "Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)" at "TME_HOVER = 0x1L". I dont understand it, how to fix that error? Thanks.
Posted
Updated 17-Oct-12 5:29am
v2
Comments
Wes Aday 17-Oct-12 11:32am
   
Did you try TME_HOVER = 1?
Andrewpeter 18-Oct-12 0:26am
   
Thanks you, it's great idea.
Akinmade Bond 17-Oct-12 11:45am
   
You should try setting it to 1. &H1& in VB.Net translates to 1 in integer.
Andrewpeter 18-Oct-12 0:27am
   
Thanks you, it works well!

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

For C# try this:
private enum TRACKMOUSEEVENT_FLAGS : long
        {
            TME_HOVER = 0x1L
        }


Now the type of all your elements in the enum must be long.
Hope this helps.
   
Comments
Andrewpeter 18-Oct-12 0:38am
   
Thank you very much, it works well. My vote is 5 for you.
Akinmade Bond 18-Oct-12 6:05am
   
Then choose his answer as solution, so this question would be resolved. :)
Andrewpeter 18-Oct-12 9:35am
   
Yes, i forgot about that, thanks.
Akinmade Bond 18-Oct-12 9:48am
   
:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190524.1 | Last Updated 17 Oct 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100