|
Luc Pattyn wrote: little ones can be cured easily
Only if you believe the SPAM...
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
First of all I posted in this forum for the first time.( i know it is a mistake now).
Secondly if my code was working i will not be looking for help. About deleting my code and reposting the question. You only said that it does not look right.
Anyway i will do it myself thanx have a nice day
|
|
|
|
|
People here are more than willing to help out; however there are some rules to make that easier and to get things a bit streamlined. Good luck with those threads.
|
|
|
|
|
thanx buddy
|
|
|
|
|
safame20 wrote: i know it is a mistake now
Posting was not the mistake that you made.
safame20 wrote: You only said that it does not look right.
I said no such thing.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Hi
i am new in C#. i am developing a banking system in which each bank sends encrypted messages to each other. i am using 3-DES algorithm.
i am facing following problem.
user sends encrypted message to bank A and bank A decryptes it.here this algorithm works fine but when bank A sends this to Bank B then i am getting this runtime error
"Invalid character in a Base-64 string."
i am using the following code.
string cipherText = richTextBox2.Text.Trim();
string mykey;
byte[] keyArray;
byte[] toDecryptArray = Convert.FromBase64String(cipherText);
StreamReader objReader = new StreamReader("c:\\encryptkey.txt");
mykey = objReader.ReadToEnd();
objReader.Close();
if (mykey.Length < 24) mykey = mykey.PadRight(24, '.');
keyArray = UTF8Encoding.UTF8.GetBytes(mykey);
tdes.Key = keyArray;
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
ICryptoTransform myTransform = tdes.CreateDecryptor();
byte[] resultArray = myTransform.TransformFinalBlock(toDecryptArray, 0, toDecryptArray.Length);
tdes.Clear();
data = UTF8Encoding.UTF8.GetString(resultArray);
the same code works very fine for first time decryption but not for 2nd time. i am getting error in
byte[] toDecryptArray = Convert.FromBase64String(cipherText);
plz help me.
thanx
|
|
|
|
|
So, when you look at it in a debugger, what is the invalid character and where did it come from? Are you sure there are no control characters getting added on somewhere?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Hi All;
I have created a user control that contains a generic list. When I instantiate this control in a Windows Form for some reason and array of the list type as (List<of type="">) is being added to the forms resources (.resx file). It runs ok for 2/3 times and then I get an error as follows:
Object of type 'NameSpace.Type[]' cannot be converted to type 'NameSpace.Type[]'. (where Namespace and Type are my class namespace and type.
Both list type and usercontrol are in teh same namespace.
Can anyone please help in clearnign this.
Thanks
Bin
|
|
|
|
|
I have had this problem before, but not for some time.
If memory serves it is caused by your having changed the Namespace.Type[] class/control/whatever in some way and when you next try to load the parent form it still has the 'old' style one serialized and of course cannot deserialize it. Again purely from memory the work-around is to delete the *.resx file for that form, although renaming/moving it might be safer from a restoration point of view.
Also a long, long, long time ago .NET 1.0/1.1 days this could happen if the 'build' part of the version information changed between runs. Not sure if this still applies though. The work-around here was to change the Version specification from [assembly: AssemblyVersion("X.Y.*.*")] to [assembly: AssemblyVersion("X.Y.*.1")] in AssemblyInfo.cs.
Hope this is of some help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'
|
|
|
|
|
Hello Henry;
That's it. I have to remove the UC instance from my form everytime I do an update to it, before recompling.
Thanks
|
|
|
|
|
|
Hi,
That is an ugly piece of code. For one, lacking any indentation, it is hardly readable; please read the forum guidelines (how to ask a question) and use PRE tags. Then a lot of declarations are absent, making it hard to understand. I also wonder where the code shown resides, is it part of some event handler, maybe a button click one?
Furthermore, the definition of DoWork() is absent, and it seems like a strange way to specify the thread's jobs. I'm not sure how "x" will ever get from the thread calculation result into the ListView either.
I suggest you edit your existing message and fix it with PRE tags and declarations, so someone can maybe give you further directions.
|
|
|
|
|
Hello,
How can I measure the time that controls are being painted on a panel ?
Thanks,
berlus
|
|
|
|
|
If I understand you correctly you have a Form, a Panel on that Form, and some Controls on the Panel. The Controls get painted whenever there is a need to, and you would like to measure how long it takes to paint them. Correct?
I could explain how to get the measurement done (or what to change so it can be done), however I'd rather tell you that you asking this tells me (1) it is slow, and (2) you should fix that.
Event handlers, including the Paint handler, should execute in a snap, never keeping the GUI thread busy (or waiting) for more than say 20 milliseconds, otherwise the GUI experience would be bad (e.g. a window covering most of your form, then disappearing, would take too long for everything to settle; or you dragging the Form by its title would not follow your mouse smoothly).
I suggest you tell more about your current situation: which controls, showing what kind of data (and where it comes from), etc. Plus a detailed symptom description.
|
|
|
|
|
Thanks for your answer.
I'm developing a GDI+ (can't use direct draw or open GL) framework, and i'm trying to decide between two alternatives to draw a certain symbol.
In order to decide which method to use, i'm creating a PanelWithStopwatch (derived from Panel), and drawing on this panel the desired symbol.
I want to use the stopwathc to measure the time that each panel was painted.
I hope I have clarified the need for the performance test.
Thanks,
Berlus
|
|
|
|
|
I understood you had Controls on the Panel, now you say it is a symbol, so I'm still confused. If there are no listing controls involved (ListBox, TreeView, DataGridView) and no databases, I doubt it will take more than say one millisecond (unless you are messing with huge images, transparency, ...).
Anyway, you could implement one way of painting things, then have a button click handler that contains:
start stopwatch
for (onethousand times) Panel.Refresh
stop stopwatch
This should repaint your panel all the time, whatever it contains. And then you could repeat it with your alternative way of painting things.
When in doubt it really repaints every time, change it a bit, e.g. perform a TranslateTransform.
|
|
|
|
|
Thanks,
By symbol I mean a GDI+ drawings (such as pen, circle, etc).
Do you have any suggestions on how to implement a panel with a textbox, that upon invalidation and repainting, that text box will be updated with the amount of time it took the panel to repaint itself ?
Thanks,
Berlus
|
|
|
|
|
Hi,
you need to be more accurate when explaining things; you first said Control, then symbol, now drawing; and a pen is not a drawing.
I explained how to do it.
Here is working code:
public void RunTimingTest() {
Form f=new Form();
Button btn=new Button();
btn.Text="Start";
btn.Click+=new EventHandler(btn_Click);
btn.Bounds=new Rectangle(20, 20, 200, 40);
f.Controls.Add(btn);
lbl=new System.Windows.Forms.Label();
lbl.Bounds=new Rectangle(20, 80, 400, 30);
f.Controls.Add(lbl);
p=new MyPanel();
p.Bounds=new Rectangle(20, 150, 200, 100);
p.BackColor=Color.Yellow;
f.Controls.Add(p);
f.Show();
}
void btn_Click(object sender, EventArgs e) {
p.Count=0;
lbl.Text="";
Stopwatch sw=new Stopwatch();
sw.Start();
int n=100*r.Next(1, 10);
for (int i=0; i<n; i++) {
p.Text="MyPanel "+i.ToString();
p.Refresh();
}
sw.Stop();
lbl.Text="Did "+p.Count+" paints in "+sw.ElapsedMilliseconds+" msec";
}
public class MyPanel : Panel {
public int Count;
public string Text;
protected override void OnPaint(PaintEventArgs e) {
Count++;
base.OnPaint(e);
e.Graphics.DrawString(Text, Font, Brushes.Black, new Point(20, 20));
}
}
The spoon feeding ends here.
|
|
|
|
|
Thanks for your answer,
I will try to explaing myself better next time.
I hope I won't vommit from your spoon , ....
Thanks,
Berlus
|
|
|
|
|
Did you solve your problem? What is the outcome?
|
|
|
|
|
Hi,
How can I find all the positions of the word hello in string s1?
Note that I do not want to use the built in pattern matching functionality such as:
String::split(), String::indexOf(), String::lastIndexOf(), String::substring(), Regex.Match(),
string s1 = "Hello how are you, hello how are you, hello how are you this morning"
string s2 = "Hello"
The above should return:
1, 20, 39
|
|
|
|
|
|
so write your own little method by walking the string and comparing individual characters.
Extra challenge: make sure you get it right when one or both strings stutter, as in: locating "cucumber" in "I don't like cucucumbers at all".
|
|
|
|
|
This is the C# forum, not C++. You should be asking this in the Managed C++/CLI forum instead.
|
|
|
|
|
Why sir, it is deserted; there is more people on Mount Everest than there is in the C++/CLI forum. And the problem can be solved in any language.
|
|
|
|
|