Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
I converted VB.net code to C# code on a website:

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


Converted result (C# code):

C#
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
[no name] 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

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


Now the type of all your elements in the enum must be long.
Hope this helps.
 
Share this answer
 
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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900