Click here to Skip to main content
15,886,766 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai all,

In my program i am having public shared function...........

VB
Public Shared Function ComputeCrc(ByVal data As Byte()) As UInt16
      Dim crc As UShort = &HFFFF

      For Each datum As Byte In data
          crc = CUShort((crc >> 8) Xor CrcTable((crc Xor datum) And &HFF))
      Next

      Return crc
  End Function


I need to call this function with my string "str".... and also carry the return value ....... HOW?
Please give some instructions..........


Thank You


[edit]Code block added, "Treat my content as plain text..." option disabled - OriginalGriff[/edit]
Posted
Updated 4-Mar-12 20:56pm
v3

1 solution

Try:
VB
Dim myString As String = "assdfdfgsdfg"
Dim retval As UInt16 = [MyClass].ComputeCrc(System.Text.Encoding.ASCII.GetBytes(myString))
 
Share this answer
 
Comments
Himachandra 5-Mar-12 3:04am    
Gives an Error:"MyClass is not declared"
Sergey Alexandrovich Kryukov 5-Mar-12 3:06am    
Use its full name. Or "Import TheNameSpaceOfMyClass"; use appropriate namespace name.
--SA
Sergey Alexandrovich Kryukov 5-Mar-12 3:08am    
Are you serious?! "MyClass" was just an example, and only because you failed to show the class name in your code, which was a big mistake of you as it is the only relevant item. Of course use the real class name.
--SA
Sergey Alexandrovich Kryukov 5-Mar-12 3:09am    
My 5, but OP is so innocent that it would require more detailed explanation :-)
--SA
Himachandra 5-Mar-12 3:11am    
Run Time Error: Argument NullException was unhandeled.

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



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