|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
This is a Bug, but whose? VB.Net or Mine?Given the following Enums: <Flags()> _ Public Enum EMethod As UInteger Buffered = 0 InDirect = 1 OutDirect = 2 Neither = 3 End Enum <Flags()> _ Public Enum EFileDevice As UInteger Beep = &H1 CDRom = &H2 CDRomFileSytem = &H3 Controller = &H4 Datalink = &H5 Dfs = &H6 Disk = &H7 DiskFileSystem = &H8 FileSystem = &H9 . . (more --removed for clarity) . End Enum I declare another Enum: Public Enum EIOControlCode As UInteger . . FsctlSetCompression = (EFileDevice.FileSystem << 16) Or (16 << 2) Or EMethod.Buffered Or ((FileAccess.Read Or FileAccess.Write) << 14) . . End Enum Elsewhere, I declare two variables: Dim X As EIOControlCode = EIOControlCode.FsctlSetCompression Dim Y as UInteger Y=(EFileDevice.FileSystem << 16) Or (16 << 2) Or EMethod.Buffered Or ((FileAccess.Read Or FileAccess.Write) << 14) and observe that variable X has the hex value of 639040 (wrong) and that variable Y has the hex value of 9C040 (correct) Note that the code setting Y is exactly the same as the code setting the Enum element. Same code, different results. The only difference is that the Wrong results are a product of VB.Net's evaluation of the code in the Enum at compile time whereas the correct results are produced at run time. The problem, of course is that the EIOControlCode Enum runs to over 100 entries which I now have to consider suspect at best. Any help will be appreciated. -- Jim Parsells
Show quote
Hide quote
"Jim Parsells" <JimParse***@discussions.microsoft.com> wrote in message Sorry, but I get 9c040 for both values. Double check your formatting of the news:1EE38E4A-EB4B-48F3-95A9-A3B5BF88D2DE@microsoft.com... > Using VS2008 targeted at Framework 2.0 on XP SP3 (32 bit) > > Given the following Enums: > <Flags()> _ > Public Enum EMethod As UInteger > Buffered = 0 > InDirect = 1 > OutDirect = 2 > Neither = 3 > End Enum > > <Flags()> _ > Public Enum EFileDevice As UInteger > Beep = &H1 > CDRom = &H2 > CDRomFileSytem = &H3 > Controller = &H4 > Datalink = &H5 > Dfs = &H6 > Disk = &H7 > DiskFileSystem = &H8 > FileSystem = &H9 > . > . (more --removed for clarity) > . > End Enum > > I declare another Enum: > > Public Enum EIOControlCode As UInteger > . > . > FsctlSetCompression = (EFileDevice.FileSystem << 16) Or (16 << 2) > Or > EMethod.Buffered Or ((FileAccess.Read Or FileAccess.Write) << 14) > . > . > End Enum > > Elsewhere, I declare two variables: > > Dim X As EIOControlCode = EIOControlCode.FsctlSetCompression > Dim Y as UInteger > Y=(EFileDevice.FileSystem << 16) Or (16 << 2) Or EMethod.Buffered Or > ((FileAccess.Read Or FileAccess.Write) << 14) > > and observe that variable X has the hex value of 639040 (wrong) > and that variable Y has the hex value of 9C040 (correct) > > Note that the code setting Y is exactly the same as the code setting the > Enum element. > > Same code, different results. The only difference is that the Wrong > results > are a product of VB.Net's evaluation of the code in the Enum at compile > time > whereas the correct results are produced at run time. > > The problem, of course is that the EIOControlCode Enum runs to over 100 > entries which I now have to consider suspect at best. > > Any help will be appreciated. > -- > Jim Parsells output? 639040 is 9c040 expressed as an integer. -- Mike Jim Parsells wrote:
Show quoteHide quote > Using VS2008 targeted at Framework 2.0 on XP SP3 (32 bit) I can't repeat it. I get 9C040 for both. How are you displaying the > . > FsctlSetCompression = (EFileDevice.FileSystem << 16) Or (16 << 2) Or > EMethod.Buffered Or ((FileAccess.Read Or FileAccess.Write) << 14) > . > Dim X As EIOControlCode = EIOControlCode.FsctlSetCompression > Dim Y as UInteger > Y=(EFileDevice.FileSystem << 16) Or (16 << 2) Or EMethod.Buffered Or > ((FileAccess.Read Or FileAccess.Write) << 14) > > and observe that variable X has the hex value of 639040 (wrong) > and that variable Y has the hex value of 9C040 (correct) > > Any help will be appreciated. hex? writeline("x = {0,8}",Hex(x)) writeline("x = {0:X8}",CType(x,Uinteger)) writeline("y = {0:X8}",y) x = 9C040 x = 0009C040 y = 0009C040 -- OK guys ...
Silly me, I had clicked the Hex button in VS2008 and ASSUMED that it would show me all the values in Hex. I just never pushed beyond that to see what the actual hex was for the result it was showing as I hovered the mouse over the various variables. Hmmm ... it did show the Hex of everything not expressed as a member of the Enum in question. Somehow I just missed the fact that 639040 did not have &H prepended. Thanks. -- Show quoteHide quoteJim Parsells "Mike" wrote: > Jim Parsells wrote: > > Using VS2008 targeted at Framework 2.0 on XP SP3 (32 bit) > > . > > FsctlSetCompression = (EFileDevice.FileSystem << 16) Or (16 << 2) Or > > EMethod.Buffered Or ((FileAccess.Read Or FileAccess.Write) << 14) > > . > > Dim X As EIOControlCode = EIOControlCode.FsctlSetCompression > > Dim Y as UInteger > > Y=(EFileDevice.FileSystem << 16) Or (16 << 2) Or EMethod.Buffered Or > > ((FileAccess.Read Or FileAccess.Write) << 14) > > > > and observe that variable X has the hex value of 639040 (wrong) > > and that variable Y has the hex value of 9C040 (correct) > > > > Any help will be appreciated. > > I can't repeat it. I get 9C040 for both. How are you displaying the > hex? > > writeline("x = {0,8}",Hex(x)) > writeline("x = {0:X8}",CType(x,Uinteger)) > writeline("y = {0:X8}",y) > > x = 9C040 > x = 0009C040 > y = 0009C040 > > -- >
use variable as textbox name?
treeview in windowsdialog Call button click event Visual Studio 2008 and Classes Inheriting From System.Web.UI.WebControls.Style Problem with embedded carriage returns trouble reading word documents Good tutorial for working with XML Using function with PChar data type still problems reading word documents... how to know if to close sqlreader |
|||||||||||||||||||||||