No the problem is that you are using threads and you think that there should be an order.
It is simple - stopping thinking that. There is no order. It doesn't matter how you create them nor execute them - there still is no order.
If you want an order then you must assert that order yourself into the code.
HOW you do that depends on what you actually want to acheive. It could be as simple as just ordering the final set after processing of all the threads completes. Or providing a bucket into which each thread puts its result.
Sometimes the execution order does not matter, but the publishing of the result (e.g. if your processing takes significant time before results are available). In this case you should spinup the threads and let them execute in any order as they will, but when the results are available wait for the completion of the "previous" thread and then publish your results.
Using a pattern like this would allow to use the parallel execution of the long processing and still have the serialized behavior at time of the publishing of the results.
In last week, I wanted to make a presentation viewer(Slide show) using C#.
I went through MS-PowerPoint and its done but licensed(So not of my use).
MS-PowerPoint Viewer(No support in C#).
Then LibreOffice and OpenOfficeOrg- Too much complicated to use, having errors in libraries.
So what may be the best way to implement a presentation controller in my form.
I can use C# or C++.
Remove this post. It's VERY unlikely that the person you're addressing this to will ever see it and the only people interested in your email address are the spam bots that scan these forums pretty regularly looking for email addresses to send all kinds of spam to.
Post your question in the forum at the bottom of the article that you're talking about.
I am having issues with maintaining info when person uses browser back button. I work for a company which is an online traffic school course. The issues I am having is say a student starts on lesson 1. Within lesson 1 there are 10 pages of content that they must read and click Next button to go to next page. Once they then have read all 10 pages, then they go to a quiz where they are given one question at a time (there are 5 questions). They click Next button to move to each question. Once they have answered all questions, then they go to a grade page. If they passed, then they click on continue button to go to lesson 2. Then onto quiz for lesson 2. This part all works great and if they click our programmed Back buttons everything works great as well. The problem is if they go from say lesson 1 all the way to lesson 3 (just an example) and they decide to use the browser's back button to go all the way back to lesson 1, everything tends to get messed up. Since we are driving off of class Student which contains current lesson num, current page num, current question num, once we advance further in the course these values get updated. My problem is that when the student continuously clicks the browser's back button the lesson num, page num and question num (and other content) does not follow suit to what it was. I am not sure why, but the pages are not being cached. Is there anyway to maintain the lesson num, page num and question num as the student clicks browser back button? Meaning as they click back to quiz from lesson 2, it shows lesson 2 (it is currently showing lesson 3 since that is how far have advanced) and same with the lesson pages that they must read. I have tried to use hidden input, but it does not seem to work correctly all the time. Any ideas???
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
As others have said, this really should be in the ASP.NET forum. However, some food for thought for you - what you are looking at maintaining is effectively the maximum point they have reached. To this end, you might want to use a combination of the user Session and a database (if the user can log out and log back in) to hold this value.
I was brought up to respect my elders. I don't respect many people nowadays.
Our database maintains current lesson, page, question, advanced (furthest point reached) lesson, page, question, and max (furthest point to reach) lesson, page, question. As the student moves forward, the current and advanced values get set. For example, when the student views the lesson the .ASPX page displays lesson # and page #'s available in lesson with current page highlighted and the lesson content (the verbage they must read to pass the quizzes) for that lesson/page combo is displayed. As they move forward in the pages, the highlighted page # changes and the lesson content changes. Once they reach the max page for that lesson and they click on Next button, they then go to quiz. On quiz ASPX page, the lesson and question # are displayed (lesson # and question # are set by current lesson and current question values) as well as the associated question and possible answers. Once student then goes to lesson 2, current lesson # = 2, current page # = 1, advanced lesson # = 2 and advanced page # = 1. Now I have noticed different things happen based on what browser is being used. For example in Firefox, once student goes all the way through lesson 1, takes lesson 1 quiz, passes and goes to lesson 2. Now if student clicks browser back button everything seems to be ok, it appears to be cached. If student clicks browser back button to lesson 1 quiz question 2, everything seems to be ok. That is it shows Lesson 1 Question 2 with the appropriate question and possible answers (with their answer selected). However, if student goes all the way back to lesson 1 quiz question 1, it displays Lesson 2 question 1 but with lesson 1 question 1 question and answer. Now if student clicks on our programmed Next button, the program now thinks we are on lesson 2 quiz and next shows lesson 2 question 2 along with a question and possible answers that are indeed from lesson 2 and none of the answer radio buttons are set since have not taken lesson 2 quiz.
I would have thought that everything would have been cached. So no matter how many times I click browser back button from my furthest point it would be showing exact pages I went through in reverse order, but this is not the case. Any ideas???
I have a couple of questions, half C# related, the other half, less C# related, but more related to embedding URL in C#, thank you for your attention.
I'm writing a console app (in C#) that is supposed to pop up the default mail software, fill in the recipients, subject and body.
this data is acquired from a txt file the app processed.
To do that I start a process (IEXPLORE)
and give it the @"mailto:...", A regex I created from the processed data.
problem is, the body of the text does not take \n seriously and well, basically I have one long line where five should be.
one of my questions is, how do I get a URL to produce a line break?
A second issue is that the app is also supposed to attach the attachments, whose full local path has been processed from the latter mentioned txt file.
i used the &attachments="c:\..." and well, no attachments..
Now for the more C# related part...
the app has two bi-products :
It opens a console windows which needs to be manually closed
IT opens an explorer window that needs to be manually closed
I am a novice programmer and still do not know much about threads.. I understand that I will have to use them somehow, could someone point me in the right direction?
You don't. A URL is a continuous sequence of characters, and should remain so - plus, if you could break the line, where would you break it? Just because it fills a line of text on your monitor doesn't mean that it won't wrap when viewed on a tiny screen smartphone.
Now, as for threading, a simple way to spawn off your work is to use the Tasks Parallel Library (TPL). This[^] is a great place to get started.
I was brought up to respect my elders. I don't respect many people nowadays.