Click here to Skip to main content
16,011,374 members
Home / Discussions / C#
   

C#

 
QuestionBindingsource Question Pin
Davey_guan8-Aug-11 15:41
Davey_guan8-Aug-11 15:41 
AnswerRe: Bindingsource Question Pin
Qendro8-Aug-11 23:26
Qendro8-Aug-11 23:26 
GeneralRe: Bindingsource Question Pin
Davey_guan9-Aug-11 16:50
Davey_guan9-Aug-11 16:50 
Questioncant get this part of my program to produce the correct result Pin
stephen.darling8-Aug-11 11:45
stephen.darling8-Aug-11 11:45 
AnswerRe: cant get this part of my program to produce the correct result Pin
PIEBALDconsult8-Aug-11 15:37
mvePIEBALDconsult8-Aug-11 15:37 
GeneralRe: cant get this part of my program to produce the correct result Pin
stephen.darling9-Aug-11 4:22
stephen.darling9-Aug-11 4:22 
GeneralRe: cant get this part of my program to produce the correct result Pin
Matt Meyer9-Aug-11 4:57
Matt Meyer9-Aug-11 4:57 
GeneralRe: cant get this part of my program to produce the correct result Pin
stephen.darling9-Aug-11 5:54
stephen.darling9-Aug-11 5:54 
Matt Meyer wrote:
you'll need to test for it and reverse the array if needed.


Already done it Big Grin | :-D and that was indeed the problem.


Matt Meyer wrote:
If you're going to be converting the array back into an integer, you'll need to reverse it again since the system is looking for a little-endian byte order.


Yes; I figured that out and now it is as expected...


Matt Meyer wrote:
One minor suggestion - when you're talking hex values, always include the leading zeroes for the data types if the hex number doesn't fit perfectly (eg, 0x075BCD15 instead of 0x75BCD15).


Will do. Sorry, still learning when it comes to hex and things...

Also, I did try your code, however, as I got the existing code to work, I am currently using it. Just incase you are interested, here is the final working version. It does correctly produce the hex value of a string of digits, but in reverse order.

If you have any ideas how to reverse it, to provide a function that does the oposite and "Encodes" the byte array produced by this function, into the original string of digits that it produces, using simular code, I would be very very gratefull Wink | ;)

Here is the final, working "Decoder"

byte[] DecodeRequestCode(string requestCode, int ResLen)
        {
          // Accept a 41 digit string in the format "00000000000000000000000000000000000000"

            int Sum = 0;
            int Digit, Aux, m;
            byte[] result = new byte[17];

            for (int i = 0; i < 41; i++)
            {
                Digit = requestCode[i] - '0';

                Aux = Digit;
                m = 0;

                do
                {
                    Aux += result[m] *10;
                    result[m++] = (byte) (Aux & 255);

                    Aux >>= 8;

                }
                while (m < ResLen);

                

            }

            return result;

        }


And thank you again!
AnswerRe: cant get this part of my program to produce the correct result Pin
PIEBALDconsult8-Aug-11 16:35
mvePIEBALDconsult8-Aug-11 16:35 
AnswerRe: cant get this part of my program to produce the correct result Pin
BobJanova9-Aug-11 0:31
BobJanova9-Aug-11 0:31 
GeneralRe: cant get this part of my program to produce the correct result Pin
stephen.darling9-Aug-11 4:21
stephen.darling9-Aug-11 4:21 
GeneralRe: cant get this part of my program to produce the correct result Pin
BobJanova9-Aug-11 7:27
BobJanova9-Aug-11 7:27 
GeneralRe: cant get this part of my program to produce the correct result Pin
stephen.darling9-Aug-11 8:18
stephen.darling9-Aug-11 8:18 
GeneralRe: cant get this part of my program to produce the correct result Pin
BobJanova9-Aug-11 10:03
BobJanova9-Aug-11 10:03 
GeneralRe: cant get this part of my program to produce the correct result Pin
stephen.darling9-Aug-11 10:38
stephen.darling9-Aug-11 10:38 
Questionprofeesional sample oop project with c# Pin
mehran.asg8-Aug-11 10:56
mehran.asg8-Aug-11 10:56 
AnswerRe: profeesional sample oop project with c# Pin
Richard Andrew x648-Aug-11 11:43
professionalRichard Andrew x648-Aug-11 11:43 
AnswerRe: profeesional sample oop project with c# Pin
DaveyM698-Aug-11 12:29
professionalDaveyM698-Aug-11 12:29 
AnswerRe: profeesional sample oop project with c# Pin
Dr.Walt Fair, PE8-Aug-11 17:56
professionalDr.Walt Fair, PE8-Aug-11 17:56 
AnswerRe: profeesional sample oop project with c# Pin
PIEBALDconsult8-Aug-11 18:25
mvePIEBALDconsult8-Aug-11 18:25 
QuestionConvert Dll c#2 to WOrk on C#4 Pin
md_refay8-Aug-11 8:24
md_refay8-Aug-11 8:24 
AnswerRe: Convert Dll c#2 to WOrk on C#4 Pin
jschell8-Aug-11 8:34
jschell8-Aug-11 8:34 
GeneralRe: Convert Dll c#2 to WOrk on C#4 Pin
md_refay8-Aug-11 8:44
md_refay8-Aug-11 8:44 
GeneralRe: Convert Dll c#2 to WOrk on C#4 Pin
DaveyM698-Aug-11 12:40
professionalDaveyM698-Aug-11 12:40 
AnswerRe: Convert Dll c#2 to WOrk on C#4 Pin
PIEBALDconsult8-Aug-11 15:37
mvePIEBALDconsult8-Aug-11 15:37 

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.