|
OK, try changing the keywords in the Google link I gave you and see what it comes up with.
|
|
|
|
|
what is the different between .net frame work 4 &.net frame work 4 client profile
i found these 2 option in the target frame work so what is the different & when to use each one
md_refay
|
|
|
|
|
|
|
How can I change the cursor size of mouse via C#.
I have checked that the Cursor.Size is readonly property.
thanks the world of codeproject.
I am waiting for ur ans.
Thanks!
|
|
|
|
|
I believe you'd have to create your own cursor and set it up through the Win32 API directly. There is no equivilient in the .NET Framework.
You can get started by reading this[^].
|
|
|
|
|
Is it possible to give me a source or examples ?
|
|
|
|
|
The cursor size is a global (OS level) setting, and allowing applications to change it would be asking for usability nightmares.
You can, however, use a custom cursor, and you can create one which is a large pointer. Create a .cur file by the usual means, include it as a resource in your assembly and use this Cursor constructor[^] to load the resource stream.
|
|
|
|
|
Hi, I have a bindingsource binding to several text controls. I want to use the bindingsource.addnew() method to add a new line in the list, then move to the last record. My purpose is to set all these text controls empty to wait for input for the last record. But it failed. The bindingsource.position can not been set to the last record.
Could you please help to solve this problem? thanks.
|
|
|
|
|
to do this I think you should do the following:
DatRow dr = dsCustomerDataset.Customers.NewCustomerRow();
dr[0] = "";
dr[1] = "";
dsCustomerDataset.Customers.AcceptChanges();
then since you fill the binding source with your data set when you use the bindingSource.MoveLast() method it will fill your controls with empty data row which you'll add.
hope this will help you!
Qendro
|
|
|
|
|
|
Hello.
I have one more question, as I can not get this last function to work properly.
It takes a string of digits, of any length, like "123456789" and converts it to a byte array which is the base-10 encoding.
So if we pass the above string "123456789" into the function, we should get a byte array back which would be:
0x75BCD15 -> the hex value for the above string.
I will be passing strings between 40 and 80 digits long. And I should mention I ported the code from c++, so made some changes to get it to compile.
It does produce a correct length byte array, but the hex values are never correct.
The function is...
byte[] DecodeRequestCode(string requestCode, int ResLen)
{
int Sum = 0;
int Digit, Aux, m;
byte[] result = new byte[17];
for (int i = 0; i < 7; i++)
{
Digit = requestCode[i] - '0';
Aux = Digit;
m = 0;
do
{
Aux += result[m] *10;
result[m++] = (byte) (Aux & 255);
Aux >>= 8;
}
while (m < ResLen);
Sum += Digit;
}
return result;
}
I will be extreamly gratefull if someone could find out what I am doing wrong, and if possible, how I would reverse it to write a function that will produce the string of digits from the byte array?
Thank you again,
Kind Regards,
Stephen
|
|
|
|
|
stephen.darling wrote: I will be extreamly gratefull if someone could find out what I am doing wrong
I think you have strange expectations. And you haven't explained why you need this sufficiently. I don't think even the C++ code you first showed will do what you now describe.
However, I'll take a shot of tequila and see what I can do.
|
|
|
|
|
Hi.
The code works and does this exactly as required.
It was simply reversing the bytes
Thank you again,
Regards,
Stephen
p.s. still looking for a function to reverse it and produce a long string of digits from the byte array produced above
|
|
|
|
|
If you're byte order is backwards, odds are you're running into an Endianness issue. If you're using the code I helped with yesterday, and you're expecting the bytes in a big-endian ordered array (sounds like you are), you'll need to test for it and reverse the array if needed.
byte[] data = BitConverter.GetBytes(combined);
if(BitConverter.IsLittleEndian) {
Array.Reverse(data);
}
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.
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).
|
|
|
|
|
Matt Meyer wrote: you'll need to test for it and reverse the array if needed.
Already done it 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
Here is the final, working "Decoder"
byte[] DecodeRequestCode(string requestCode, int ResLen)
{
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!
|
|
|
|
|
How about this?
string a = "123456789" ;
int b = System.Int32.Parse ( a ) ;
string c = b.ToString ( "x" ) ;
byte[] d = System.Text.Encoding.ASCII.GetBytes ( c ) ;
|
|
|
|
|
This is one of those questions where the answer is 'I wouldn't have started from here'. The 10 and 16 base number systems never intersect, so to convert an 80 digit decimal number to hex you need to convert the whole number in one piece. That requires an extended precision integer class and while that is entirely possible it seems like overkill for this when you could just store the key in hex to start with.
That said, it is fairly straightforward if you're using .Net 4:
string decimalString = "123456789";
BigInteger key = BigInteger.Parse(decimalString);
string hexString = key.ToString("X");
If not, you will have to find a replacement for that class. (I have one, but I'm at work so I don't have access to it and I haven't written an article about it.)
|
|
|
|
|
Hi everyone, thank you for the comments.
However, it seems that this function was working after all, it is just that the endian order was different.
If I pass in a string of digits, and supposed to get, for example:
0xCB45ED56
I would be getting:
0x56ED45CB
Well, I can live whith that, as I simply reverse the byte arrar when I am done.
So my only problem now is to write a function that does the reverse....
Take the byte array that my function produces (any length) and produce a string of digits representing it in base-10?
Kind Regards,
Stephen
|
|
|
|
|
Pseudo code:
BigInteger bigInt= 0;
while(remaining.Length > 4){
bigInt <<= 32;
byte[] last4 = (last 4 bytes of remaining);
bigInt += BitConverter.ConvertToUint32(last4);
remaining = (all but last 4);
}
I'm sure that you would actually write the array part with indexers and not reallocating every time, but that's essentially what you are trying to do. If you want the string then just take bigInt.ToString at the end.
Again though I must ask, why not just store your key in hex format in the first place?
|
|
|
|
|
BobJanova wrote: Again though I must ask, why not just store your key in hex format in the first place?
Could you please explain this for me?
The reason I need to provide a string of digits is that the keygenerator (a seperate application) produces a string of digits, so that I can provide these to the user in a readable format ("000000-000000-000000-000000-000000-000000-000000-0000000-00")
After striping the 6th check-digit from each group, the 41 digit string is decoded into a 17 byte array (the function I provided).
I can then use the byte array to perform the other functions that I have, which work on byte arrays by default.
Then, this leaves me with the final problem. Using simular code that I have to reverse the function for my key gen.
It will build 17 bytes from different functions, and this time encode it into the string above.
Kind Regards,
Stephen
|
|
|
|
|
Your key generator could generate keys in the same form but with hex digits. Unless the obfuscation of the decimal-to-byte representation change is of value to you, in which case, carry on.
|
|
|
|
|
BobJanova wrote: Your key generator could generate keys in the same form but with hex digits.
I would be interested to know more here? Like I said before, I am still very new to both c# and hex etc, so if you had any code example to show me what you mean I will take a look.
If the code you posted before is what you mean, then the only reason I didnt try it was because I got my c++ copied code to work first.
Really, all I want to be able to do is convert the big string of digits to hex, and be able to convert the hex back to the long string of digits.
The reason I think I need to use bytes is simply because my other functions either take byte arrays as auguments, or return byte arrays.
Thank you again,
Kind Regards,
Stephen
|
|
|
|
|
hi
I'm not professional in oop with c#. I need a sample proffessional project. I want to learn with a project.
If you konw, please send it to me.
if you have a better idea ,please guide me.
regards.
|
|
|
|
|
There are many sample projects on this website. Just look around.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|