Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 12th, 2003, 09:48 AM
Authorized User
 
Join Date: Jun 2003
Location: Long Island City, NY, USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help - Convert from C# to VB.Net

I am having trouble converting this C# code to VB.Net. Can someone please help me? I am fluent in VB.Net and am trying to learn C# but I don't understand what is going on here completely, and don't know how to convert it to VB.Net to understand it better.

Code:
 cksum = (cksum >> 16) + (cksum & 0xffff);
       cksum += (cksum >> 16);
       return (UInt16)(~cksum);
Thanks you in advance,

Christopher P. Cooper

It's important for us to explain to our nation that life is important. It's not only life of babies, but it's life of children living in, you know, the dark dungeons of the Internet."— George W. Bush - Arlington Heights, Ill., Oct. 24, 2000
__________________
Vote Kerry/Edwards 2004

It\'s important for us to explain to our nation that life is important. It\'s not only life of babies, but it\'s life of children living in, you know, the dark dungeons of the Internet.\"— George W. Bush - Arlington Heights, Ill., Oct. 24, 2000
Reply With Quote
  #2 (permalink)  
Old July 20th, 2003, 10:06 AM
Authorized User
 
Join Date: Jun 2003
Location: Crowland, Lincs, United Kingdom.
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
I had a look at your piece of code. This code is working with bits (DWord). I am only average VB & VB.Net dev and still can not find way of doing it yet.
At present, I can help only with code breakdown meaning and I hope it would be helpful to you.

1.(cksum >> 16) means cksum's bits is shifted 16 places to the right.
2.(cksum & 0xffff) means cksum AND with hex value FFFF (binary - 111111111111)
3.(~cksum) means cksum added one compliment to its value ie, 2 (10) will equals to 3 (11). When you change it to 16 bits unsigned value (UInt16) this infacts turn it to a negative number.
I wonder what is this code for any how, you probably know C# syntax is similar to C/C++ so it can handle the low level programming. As VB is more to higher level language, I guess I can not find way of doing it in VB yet, from my point of view, this code is more suited to C# or C/C++. If you can do it please let me knows ... good luck.

Cheers
Kasie

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert C++ syntax to VB .NET hendyhanusin VB.NET 2002/2003 Basics 0 July 19th, 2007 09:52 PM
convert string to datetime in VB.net lisabb ASP.NET 2.0 Basics 3 June 19th, 2007 06:52 AM
convert PHP to VB.NET or C# eugz VB.NET 4 April 24th, 2007 01:12 PM
convert dsr file from vb to vb.net Shashi001 VB Components 1 September 22nd, 2006 12:24 PM
Syntax Help - Convert C# to VB.NET ank2go ASP.NET 1.0 and 1.1 Professional 3 July 7th, 2004 09:33 PM



All times are GMT -4. The time now is 09:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.