Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin14-Nov-17 7:41
alin14-Nov-17 7:41 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Sascha Lefèvre4-Nov-17 7:55
professionalSascha Lefèvre4-Nov-17 7:55 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin14-Nov-17 8:23
alin14-Nov-17 8:23 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Sascha Lefèvre4-Nov-17 8:29
professionalSascha Lefèvre4-Nov-17 8:29 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin15-Nov-17 2:41
alin15-Nov-17 2:41 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Sascha Lefèvre5-Nov-17 2:53
professionalSascha Lefèvre5-Nov-17 2:53 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin15-Nov-17 3:09
alin15-Nov-17 3:09 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Sascha Lefèvre5-Nov-17 3:43
professionalSascha Lefèvre5-Nov-17 3:43 
Two minor things first:

This:
C#
&& (batchSize < fileList.Count)
..isn't neccessary because it's covered already by this:
C#
|| (i == (fileList.Count - 1)

And this:
C#
if (thumbnailList.Count > 0)
..isn't neccessary because if the list is empty then the foreach-loop will just do nothing.

Now, to the problem at hand - these lines of the exception stack trace:
C#
at System.Collections.Generic.List`1.get_Item(Int32 index)
at test1.MainForm.BackgroundWorker1ProgressChanged(Object sender, ProgressChangedEventArgs e)
..tell you that the problem occurs when trying to access a List<> with its indexer in BackgroundWorker1ProgressChanged. The only candidate for this is:
C#
fileList[counter]
So it seems somehow your counter gets out of sync with the "actual progress". No idea why; maybe it's in the code you haven't shown here.

But that's a point I planned to suggest to you to improve anyway: Change it so that BackgroundWorker1ProgressChanged doesn't need to assume the index of the "delivered" bitmap in fileList by delivering not only the bitmaps but the bitmaps with their index. Either create a class for that (with Bitmap and Index as properties) and store instances of that class in the list (instead of just the Bitmap) or use a Tuple<Bitmap, int> instead of the custom class. Or, instead of using the index, use the filename and ListViewItem.ImageKey[^] instead of ImageIndex. That way you wouldn't need fileList in BackgroundWorker1ProgressChanged at all.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin15-Nov-17 4:58
alin15-Nov-17 4:58 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin15-Nov-17 13:22
alin15-Nov-17 13:22 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Sascha Lefèvre5-Nov-17 20:52
professionalSascha Lefèvre5-Nov-17 20:52 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
alin16-Nov-17 2:56
alin16-Nov-17 2:56 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Sascha Lefèvre6-Nov-17 3:00
professionalSascha Lefèvre6-Nov-17 3:00 
GeneralRe: How to make the ListView to display each thumbnail immediately after it's loaded? Pin
Gerry Schmitz4-Nov-17 7:39
mveGerry Schmitz4-Nov-17 7:39 
QuestionRun List Of Tasks Sequentially and Process Them As The Complete Pin
Kevin Marois1-Nov-17 8:47
professionalKevin Marois1-Nov-17 8:47 
AnswerRe: Run List Of Tasks Sequentially and Process Them As The Complete Pin
ZurdoDev1-Nov-17 9:37
professionalZurdoDev1-Nov-17 9:37 
AnswerRe: Run List Of Tasks Sequentially and Process Them As The Complete Pin
Sascha Lefèvre1-Nov-17 10:31
professionalSascha Lefèvre1-Nov-17 10:31 
AnswerRe: Run List Of Tasks Sequentially and Process Them As The Complete Pin
BillWoodruff2-Nov-17 17:56
professionalBillWoodruff2-Nov-17 17:56 
AnswerRe: Run List Of Tasks Sequentially and Process Them As The Complete Pin
MadMyche14-Nov-17 8:35
professionalMadMyche14-Nov-17 8:35 
QuestionC#+WebBrowser+JavaScript - full download Pin
kama_kama31-Oct-17 12:03
kama_kama31-Oct-17 12:03 
QuestionRe: C#+WebBrowser+JavaScript - full download Pin
Karthik_Mahalingam31-Oct-17 17:00
professionalKarthik_Mahalingam31-Oct-17 17:00 
AnswerRe: C#+WebBrowser+JavaScript - full download Pin
kama_kama31-Oct-17 20:08
kama_kama31-Oct-17 20:08 
QuestionWhat's The Best Way To Do This? Pin
Kevin Marois31-Oct-17 7:04
professionalKevin Marois31-Oct-17 7:04 
AnswerRe: What's The Best Way To Do This? Pin
Gerry Schmitz31-Oct-17 12:08
mveGerry Schmitz31-Oct-17 12:08 
GeneralRe: What's The Best Way To Do This? Pin
Rob Philpott1-Nov-17 3:04
Rob Philpott1-Nov-17 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.