Click here to Skip to main content
15,910,981 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: need help with backcolor command Pin
Dave Kreskowiak25-Feb-09 1:38
mveDave Kreskowiak25-Feb-09 1:38 
GeneralRe: need help with backcolor command Pin
hugblue25-Feb-09 2:09
hugblue25-Feb-09 2:09 
GeneralRe: need help with backcolor command Pin
Dave Kreskowiak25-Feb-09 4:44
mveDave Kreskowiak25-Feb-09 4:44 
GeneralRe: need help with backcolor command Pin
hugblue25-Feb-09 6:51
hugblue25-Feb-09 6:51 
QuestionHow to Create a setup of Window project Pin
Jagz W24-Feb-09 15:42
professionalJagz W24-Feb-09 15:42 
AnswerRe: How to Create a setup of Window project Pin
ABitSmart24-Feb-09 17:05
ABitSmart24-Feb-09 17:05 
QuestionNeed help converting CRC32 function in C to VB Pin
harans24-Feb-09 11:26
harans24-Feb-09 11:26 
AnswerRe: Need help converting CRC32 function in C to VB Pin
riced25-Feb-09 7:04
riced25-Feb-09 7:04 
The array can be declared in VB as
Dim CRCtable(255) As ULong = {  _
  ... Fill in with values. NB will need line continuation chars at end of each line
}


You can just copy and paste the existing declaration with three points to note.
First C does not have line continuation character so you'll have to add them.
Secondly, you don't need the ; after closing }.
Thirdly, the size needs to be changed from 256 to 255.

The function is trickier but this seems a reasonable attempt
Public Function CalcCRC(ByVal val, As ULong, ByVal buf as Byte[], ByVal len As ULong) As ULong
{
   Dim accum As ULong
   Dim i As Integer = 0
   ' Dont know what this does not standard C - EnableCaches()
   accum = val
   do while (len > 0)
      accum = (accum<<8) Xor (CRCtable((accum>>24) Xor buf(i)))
      len = len - 1
      i = i + 1
   loop
   ' Dont know what this does not standard C - DisableCaches()
   return accum
}


Possible problems:
1 The unsigned long type in C can be 4 or 8 bytes. The spec just says its size got to be at least as big as an int. So you might have to use UInt instead of ULong. The values in the array only take 4 bytes so my guess is you should use UInt.
2. A C unsigned char is essentially the same as a VB byte. So the unsigned char *buf parameter is pointing at an array of bytes (I assume of length given by len).
3. You might get off by one errors. C arrays always start at 0 with maximum index given by 1 less than in declaration. E.g int myArray[5]; gives an array of 5 elements with index 0 to 4.
4. I have no idea what EnableCaches/DisableCaches do - they are not standard C functions. My guess is they provide some sort of protection against array out of bounds exceptions.
5. This (accum>>24) Xor buf(i)) calculates an index into the array. You might have to do this using another variable. I'm not sure if this will always be in range 0 to 255. And you might have to do some casting to make it an integer.

Regards
David R

QuestionHow can I redraw the form with the controls new backcolor value? Pin
JUNEYT24-Feb-09 10:57
JUNEYT24-Feb-09 10:57 
AnswerRe: How can I redraw the form with the controls new backcolor value? Pin
Dave Kreskowiak24-Feb-09 12:48
mveDave Kreskowiak24-Feb-09 12:48 
Questioninvalid operation excpetion Pin
captainmogo24-Feb-09 5:30
captainmogo24-Feb-09 5:30 
Questiongenerating thumbnails from a list of image files *.jpg *. gif etc... Pin
syba24-Feb-09 4:57
syba24-Feb-09 4:57 
AnswerRe: generating thumbnails from a list of image files *.jpg *. gif etc... Pin
Dave Kreskowiak24-Feb-09 17:59
mveDave Kreskowiak24-Feb-09 17:59 
GeneralRe: generating thumbnails from a list of image files *.jpg *. gif etc... Pin
syba24-Feb-09 18:05
syba24-Feb-09 18:05 
GeneralRe: generating thumbnails from a list of image files *.jpg *. gif etc... Pin
Dave Kreskowiak25-Feb-09 1:33
mveDave Kreskowiak25-Feb-09 1:33 
Questionprinting xml in ie Pin
Stephen Lintott24-Feb-09 3:38
Stephen Lintott24-Feb-09 3:38 
AnswerRe: printing xml in ie Pin
Dave Kreskowiak24-Feb-09 3:58
mveDave Kreskowiak24-Feb-09 3:58 
GeneralRe: printing xml in ie Pin
Stephen Lintott24-Feb-09 19:28
Stephen Lintott24-Feb-09 19:28 
GeneralRe: printing xml in ie Pin
Dave Kreskowiak25-Feb-09 1:51
mveDave Kreskowiak25-Feb-09 1:51 
Questionconvert code into vb.net Pin
sajjadlashari24-Feb-09 1:42
sajjadlashari24-Feb-09 1:42 
AnswerRe: convert code into vb.net Pin
Dave Kreskowiak24-Feb-09 1:57
mveDave Kreskowiak24-Feb-09 1:57 
AnswerRe: convert code into vb.net Pin
Samir Ibrahim24-Feb-09 4:13
Samir Ibrahim24-Feb-09 4:13 
QuestionBeginner for creating Crystal Report with VB.NET2008 WinForm Pin
drexler_kk24-Feb-09 0:40
drexler_kk24-Feb-09 0:40 
AnswerRe: Beginner for creating Crystal Report with VB.NET2008 WinForm Pin
ABitSmart24-Feb-09 17:14
ABitSmart24-Feb-09 17:14 
QuestionRe: Beginner for creating Crystal Report with VB.NET2008 WinForm Pin
drexler_kk25-Feb-09 16:16
drexler_kk25-Feb-09 16:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.