6 Replies - 2021 Views - Last Post: 26 March 2013 - 06:33 AM Rate Topic: -----

#1 Ricky Kim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-March 13

Using VB 6 trying to calculate the checksum after input in binary

Posted 22 March 2013 - 01:36 AM

I can't figure out how to calculate the checksum after input in text1 for the data, input text1 for the divisor in binary bytes. I tried checksum.text = Text1.Text Xor Text2.Text but its not working
Is This A Good Question/Topic? 0
  • +

Replies To: Using VB 6 trying to calculate the checksum after input in binary

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Using VB 6 trying to calculate the checksum after input in binary

Posted 23 March 2013 - 02:57 AM

You need to post your code in the CODE tags (as explained in the background of the reply box). If your code isn't commented, please indicate what data you're entering.

You will also need to explain which checksum algorithm you're trying to implement, as there are many, that way, you will most likely get specific pointers.
Was This Post Helpful? 0
  • +
  • -

#3 Ricky Kim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-March 13

Re: Using VB 6 trying to calculate the checksum after input in binary

Posted 24 March 2013 - 07:46 AM

this is my code so far

 Private Sub Command1_Click()

    If Len(Text1.Text) = 0 Or Text1.Text Like "*[!0-1]*" Then
        Text3 = "Bad Binary string"
       
    Else
    If Len(Text2.Text) = 0 Or Text2.Text Like "*[!0-1]*" Then
        Text3 = "Bad binary String"
        
        Else
        checksum.Text = CStr(CLng(Text1.Text) Xor CLng(Text2.Text))
        Trans(2) = (Text1.Text) + (checksum.Text)
        Text3 = "CRC Generated"
    End If
    End If

End Sub

This post has been edited by BobRodes: 24 March 2013 - 09:05 AM
Reason for edit:: Code tags

Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Using VB 6 trying to calculate the checksum after input in binary

Posted 24 March 2013 - 09:06 AM

Ricky, I've edited your post to use code tags as maj requested that you do. If you can't read the watermarks in the response window, then please edit your post and have a look at the tags I've put in. Please use code tags in future to make your code more readable.

Also, "this is my code so far" is hardly a response to "You will also need to explain which checksum algorithm you're trying to implement", now is it? :) Help us to help you, please.

This post has been edited by BobRodes: 24 March 2013 - 09:09 AM

Was This Post Helpful? 0
  • +
  • -

#5 Ricky Kim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-March 13

Re: Using VB 6 trying to calculate the checksum after input in binary

Posted 25 March 2013 - 06:45 AM

The checksum result from input text1 Xor with text2 this input only for binary number,the result ans checksum will go to checksum.text

This is the link how checksum alghorithm calculated.
My link

checksum = 000010

sorry for the bad explaination :D
Was This Post Helpful? 0
  • +
  • -

#6 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Using VB 6 trying to calculate the checksum after input in binary

Posted 25 March 2013 - 08:18 AM

You need to create a function that will convert your binary represented text string into a number and do you calculation on that.

You can't do it directly on the string and you can't use Clng to convert it to a valid number.

You will need to look at each bit in turn and calculate the number accordingly.
Was This Post Helpful? 1
  • +
  • -

#7 Ricky Kim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-March 13

Re: Using VB 6 trying to calculate the checksum after input in binary

Posted 26 March 2013 - 06:33 AM

Thanks for the information, will try to work on it :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1