|
Guffa wrote: Many people don't know what to ask for, how to ask for it, or where to ask for it
If a person's communication skills aren't adequate, maybe they should learn better English. That *is* the language used on this site.
Guffa wrote: If you only ever answer exactly what people ask for, you often can not give them the answer that they want, or the answer that they need.
How could that guys question have been interpreted as "give me an alternative". He wanted to set the form to be invisible when it started up. I gave him the solution to *that* question. I don't care why he wants to do it.
I do some pretty whacked out stuff myself (like most of us have), and I personally don't like being quizzed as to my motives, or have some nimrod in a foreign country second-guessing me - I just want an answer to the question I posted. If you can't get your pointed little heads around that concept, then please don't answer my questions.
In any case, this conversation doesn't belong in this forum.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
In MSDN guide convert array bytes to string, here code: Encoding.UTF8.GetString(byte[] bytes) VS2005 doesn't support convert one byte to string.
Anybody can I help me? or for example how to convert one byte to string. Although, may be use to Convert.ToString(byte) is correct, but I don't think so. Except, differently another way
Thank one so much!!!!
|
|
|
|
|
Encoding.UTF8.GetString(byte[] bytes) is working. did you try the method Tostring();
|
|
|
|
|
Just make a byte array with only this byte in it.
GetString(new byte[] { myByte });
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If you encode a single character into bytes using the UTF-8 encoding, it can result in more than a single byte. It wouldn't make sense to have a method that decodes a single byte, as that would only work on a very limited part of the character set.
If you have a character that actually was encoded into a single byte, you just have to put that byte in an array to decode it.
If you are trying to decode data byte by byte, that doesn't work, as some characters may need more than one byte of the data.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: If you have a character that actually was encoded into a single byte, you just have to put that byte in an array to decode it.
If you have a character that was encoded into a single byte using UTF8, then it was an ASCII character.
Instead of allocating lots of small byte arrays, you can just do this:
char DecodeASCII(byte b)
{
if (b >= 128)
throw new ArgumentException("This is not a single-byte character");
else
return (char)b;
}
|
|
|
|
|
this is the code i use to encrypt the "ser.xml"and send it to the server.
but when trying to decrypt this at server i get the exception "Unable to cast object of type 'System.Security.Cryptography.RSACryptoServiceProvider' to type 'System.Security.Cryptography.SymmetricAlgorithm'."
private void encrypt_msgxml()
{
XmlDocument xmldoc = new XmlDocument();
XmlElement element_to_enc;
Rijndael sessionkey;
EncryptedXml enxml = new EncryptedXml();
byte[] encryp_bytes;
byte[] encrypt_keyarray;
EncryptedData encrypt_element;
xmldoc.PreserveWhitespace = true;
xmldoc.Load("ser.xml");
element_to_enc = xmldoc.GetElementsByTagName("message")[0] as XmlElement;
sessionkey = new RijndaelManaged();
sessionkey.KeySize = 256;
encryp_bytes = enxml.EncryptData(element_to_enc, sessionkey, false);
encrypt_element = new EncryptedData();
encrypt_element.Type = EncryptedXml.XmlEncElementUrl;
encrypt_element.EncryptionMethod = new EncryptionMethod(EncryptedXml.XmlEncAES256Url);
EncryptedKey encrypt_key = new EncryptedKey();
encrypt_keyarray = EncryptedXml.EncryptKey(sessionkey.Key, rrsa, false);
encrypt_key.CipherData = new CipherData(encrypt_keyarray);
encrypt_key.EncryptionMethod = new EncryptionMethodEncryptedXml.XmlEncRSA15Url);
encrypt_element.KeyInfo = new KeyInfo();
KeyInfoName kin = new KeyInfoName();
kin.Value = "cli_ser_pub_key";
encrypt_element.KeyInfo.AddClause(kin);
encrypt_element.KeyInfo.AddClause(new KeyInfoEncryptedKey(encrypt_key));
encrypt_element.CipherData.CipherValue = encryp_bytes;
EncryptedXml.ReplaceElement(element_to_enc, encrypt_element, false);
xmldoc.Save("test.xml");
}
this is the code to decrypt.(i have created the rsa object in the server )
public void decrypt_msgxml()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load("test.xml");
EncryptedXml exml = new EncryptedXml(xmlDoc);
exml.AddKeyNameMapping("cli_ser_pub_key", rsa);
exml.DecryptDocument();
}
can you tell me the reason for this.
|
|
|
|
|
prasadbuddhika wrote: can you tell me the reason for this.
Before trying encryption, learn the difference between asynchronous and asymmetric. Neither of which you are using as far as I can tell.
|
|
|
|
|
this link[^] may helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi,
VS2005 Winforms.
Im creating a form which has a panel which can hold a number of different user controls.
The user control to display is decided at runtime.
To give a more professional look I want the user controls to fade into view.
Ive seen how this is possible on winforms using the opacity property.
Is there any way of achieving this on user controls also?
Many thanks,
Chas
|
|
|
|
|
Maybe you could create a bitmap that has the background color of the form, position it over the control, and fade the bitmap off (instead of fading the control on).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
The Opacity property only works for an entire form, not individual controls.
|
|
|
|
|
|
That works in WPF, not Windows Forms. There's a (huge) difference...
|
|
|
|
|
Like I said it was a quick search. Here's a link where WPF is not even mentioned. And it is not easy to do, but I know there is a way since several 3rd party control libraries do support transparent controls:
https://dotnetcentral.net/Weblog/posts/247977.aspx[^]
|
|
|
|
|
Oh I know it can be done, just not without writing your own drawing code for each control you want to be transparent. That's quite a lot of work for something that's rarely a functional requirement.
|
|
|
|
|
True. But in our case we need something wizbang as we are a startup in an established niche industry. Taking advantage of some of the drawing capabilities that a 3rd party library offers gives us a nice visual impact on startup of the app.
Hopefully we will be able to match impact with the rest of the app.
|
|
|
|
|
Ok I found I need to use WPF to do this correctly...
However i managed to simulate what I want by doing the following:
Create a tiny fading form with A FormBorderStyle property set to None and a ControlBox property set to False.
When user control is placed on the screen, calculate the position and size and display the fading form on top which fades out of existence and closes.
The only issue is that the current form looses focus - but this isnt too much of a problem as the user control fills out most of the form.
|
|
|
|
|
I wonder where Iam going wrong with these codes;
// form1.cs
private void matchbutton_Click(object sender, EventArgs e)
{
string TagNum;
TagNum = InputBox.Text;
string dataqueue;
dataqueue = myRecord.find();
if( TagNum == myRecord.find())
{
OutputBox.AppendText(" Match");
//InputBox.Clear();
}
else
{
OutputBox.AppendText("No Match");
..............................................................
// queue.cs
public Boolean contains()
{
return (find() != null);
}
public string find()
{
queuedata current = first;
while(current !=null && !current.GetType().Equals(this))
current = current.nextdata;
return current.ToString();
|
|
|
|
|
Angelinna wrote: I wonder where Iam going wrong with these codes;
Do you think that we are gonna get a dream of problem.
Atleast, explain where and what problem you are facing...
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
First of all you should tell us what the code is expected to do and what are the errors you are getting when you run it.
I think you are trying to search for a string in a queue with the code if( TagNum == myRecord.find()) .
ok lets see what this find() function does;
it is just a while loop, looping till the end of the queue and it returns when end of the queue is obtained. So it returns null .
|
|
|
|
|
Certainly. I am trying to search for a number in the queue such that if I put that number in a textbox, and click on a match button, a search takes place. If the number is found to be present, then I get a message in my output(a richtextbox) box that the number is indeed present and if not present, I get a message in my output box that the number is actually not among those in the queue.
Thanks
modified on Saturday, September 6, 2008 6:38 AM
|
|
|
|
|
Were you aware that Visual Studio comes with a very capable debugger?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I second that. It is amazing how many people I meet, who are unaware of how capable Visual Studio's debugger. I mean, how hard is it to press F9 on suspect lines of code, and run the damn thing?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
What is wrong in your code?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|