|
My best guess is userinfos1 is declared as an array, however you haven't yet created an array.
In .NET arrays take three steps: declaration, creation (with the "new" keyword), and stuffing.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
mainData variable seems to have a null.
|
|
|
|
|
Hi,
I need to add x509Extension to x509Certificate2 class but i dont know how (i read somewhere its not possible so im not sure about it).
Lets imagine this code :
X509Certificate2 cert;
X509Extension ext;
cert.Extensions.Add (ext);
byte [] b = cert.export (X509contentType.Cert);
X509Certificate2 cert2 = new X509Certificate2 (b);
// Here comes the problem ... there is no my extension in the cert2 collection.
Btw: I create it by calling c function CertCreateSelfSignCertficate. Is there any way to add my extension to created certificate or the only way to add it is in the creation time?
i rack my brain with this issue for several days so any help would be very appreciated.
thanks
Libor
|
|
|
|
|
Hi,
my problem is the following: I wrote a program that downloads lots of images from the internet (not porn though :P). Anywhoo, when i had the entire program in one thread it was not very responsive during the downloading (i used application.doevents in between the downloading cycles). When i added a separate thread for the downloading part i could move the windows around on the screen quickly and with no problems. What i don't quite understand is the why.
What controls the movement of the program window during execution? Does the main thread decide how much processor time it gives for the program and how much for the movement? When does the main thread end? Does it ever end, due to the fact that it has to handle button clicks?
Does main thread end when there are multiple threads? If it does end before the downloading thread, how can the smooth window movement during downloading be explained (as there is still only one thread running?).
TY
|
|
|
|
|
Hi,
when your app starts, it has only one thread, the "main" or "GUI" thread. It gets more if and when you create them (Thread, ThreadPool, BackgroundWorker) or perform asynchronous I/O operations (e.g. SerialPort.DataReceived).
All GUI operations (including window moving and resizing) are handled on the main thread; that mainly consists of executing the event handlers you provide, such as Form_Load, Button_Click, and many others. The events that trigger them are collected in an "input queue" and executed one by one, so one handler has to finish before the next one can start; that is why a window won't move if it is in the middle of a lengthy operation inside say a Button_Click handler. With one exception: when Application.DoEvents() is called often enough, everything may appear to be running smoothly (in reality you are running a big risk of instability, one should avoid DoEvents most of the time).
To keep the GUI responsive one should limit the execution time of each handler to a small timespan, say 30 milliseconds. Anything that always or sometimes may take more should be delegated to another thtead; otherwise the user will dislike the way he looses control of the GUI.
And the main thread comes to an end when it has no more work to execute, that typically happens when the main form gets closed causing the Application.Run() method to return in the static Main() method (inside file Program.cs); unless you started some threads that still haven't finished executing their code and didn't get marked with IsBackground=true.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Is that one of your 'out of the box' answers or did you actually compose it? Very good whichever way.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
that was an instantaneous composition, but I might add it to my collection of standard replies. Good suggestion.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I did actually start writing a response but I cancelled it with the thought that you would inevitably provide a better answer... and right I was
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: inevitably
You shouldn't give in so easily; I might be absent, late or completely wrong.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Maybe... but I think you will still be posting here long after your dead, and with the same quality as always
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
You may be right there. My bot seems to be passing the Turing test quite well.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
mine is useless, it remembers things but its understanding of sentences is very limited
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
Wooow!!! Very good answer!
|
|
|
|
|
Good one indeed, thank you
|
|
|
|
|
Great explanation. MVP status justified (yet again)
Whenever you write a book or you already have, just inform us. I will surely buy one.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Indeed, I would too be very interested in a book from Luc
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thank you.
I haven't written a book yet, and I don't plan to.
I did collect a lot of good answers (others and mine) to many questions, all in all some 100 pages in Word right now. Occasionally I turn some of it into a little article[^].
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Forgot some:
- I did create a couple of in-house courses, the most elaborate one was on Java (more than 10 years ago) when we decided to move an entire team from C to Java;
- and I did start two manuscripts that each might become a book one day, one on software performance, and one on software debugging. But I wouldn't hold my breath, progress is minimal.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Luc Pattyn wrote: With one exception: when Application.DoEvents() is called often enough, everything may appear to be running smoothly (in reality you are running a big risk of instability, one should avoid DoEvents most of the time).
In case you are wondering why DoEvents is bad: It is because DoEvents can lead to method reentrancy issues.
Good post though
|
|
|
|
|
Right. If you're lucky, you run out of stack right away; if unlucky, you'll notice something is wrong after deployment.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Great answer Luc
|
|
|
|
|
Another important thing to consider when working with a multi-threaded application is to safely end all worker threads when application is closing. Your application won't quit completely when there are active worker threads. One easy way to do this is to use background threads(Thread.IsBackGround = true ). Background threads will be aborted automatically when the main thread exits and application will quit smoothly.
My 2 cents
|
|
|
|
|
|
Before you learn how to use the ReportViewer control, I suggest that you learn how to use Bingle.
To help you further here is a search phrase to try. No guarantees, you understand, but it just might find the results that you want!
c# reportviewer
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.”
|
|
|
|