Click here to Skip to main content
15,906,766 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult6-Sep-10 18:35
mvePIEBALDconsult6-Sep-10 18:35 
Questionhow to update listView on all clients machines when new data was added? Pin
kai-best4-Sep-10 5:06
kai-best4-Sep-10 5:06 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
Not Active4-Sep-10 5:41
mentorNot Active4-Sep-10 5:41 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:23
kai-best5-Sep-10 2:23 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
Not Active5-Sep-10 2:59
mentorNot Active5-Sep-10 2:59 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 4:12
mveOriginalGriff5-Sep-10 4:12 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
Not Active5-Sep-10 5:07
mentorNot Active5-Sep-10 5:07 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 5:15
mveOriginalGriff5-Sep-10 5:15 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff4-Sep-10 6:05
mveOriginalGriff4-Sep-10 6:05 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:29
kai-best5-Sep-10 2:29 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:44
kai-best5-Sep-10 2:44 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 4:10
mveOriginalGriff5-Sep-10 4:10 
GeneralRe: how to update listView on all clients machines when new data was added? [modified] Pin
kai-best6-Sep-10 3:22
kai-best6-Sep-10 3:22 
QuestionRule Engine Pin
Shubhabrata Mohanty4-Sep-10 3:45
Shubhabrata Mohanty4-Sep-10 3:45 
AnswerRe: Rule Engine Pin
dan!sh 4-Sep-10 4:40
professional dan!sh 4-Sep-10 4:40 
QuestionUpdating a progress bar in a loop Pin
Keith Vitali4-Sep-10 2:25
Keith Vitali4-Sep-10 2:25 
Hello everyone,

I have a control update problem where I am unable to update a progress bar during a loop.

I have a winform object in C# which contains a progress bar. The program interfaces with a C++ DLL through the use of delegates. I have a simple dumb loop on the C++ side (which simply calls back to update the progress bar value). The loop is as follows:

// This line simply creates the dialog on the C# side
HANDLE handle = CreateProgressDialog();
for (int i = 0; i < 100000; ++i)
{
   int val = i%100;   
   // Just set the progress bar value between 1 and 100 inclusive
   SetProgressValue(handle, val+1);
}


On the C# side, it is as follows for the progress bar update function.

// Set the value of the progress bar to the specified value.
public void SetProgressValue(IntPtr handle, int value)
{            
   pdt.SetProgressValue(value);
   pdt.Refresh();   
}


Now, the update does not happen frequently enough and I never see the progress bar move beyond the value of 10. The progress bar moves fast as expected but it does not update all the times (and has a strange affinity for update when the progress value is low!). When I debug and step through, everything is fine. I am guessing this is because there is plenty of time to update...

Also, I even tried calls like System.Windows.Forms.Application.DoEvents() instead of update() but with no change.

I should mention that everything is called from the same thread (the loop and the SetProgressValue() calls).

When I use something like Thread.Sleep(100) at the end of SetProgressValue() function, it behaves better. However, I was wondering if there was a better way to achieve this.

I would appreciate any help you can give me.

Thanks,
Keith
AnswerRe: Updating a progress bar in a loop Pin
Henry Minute4-Sep-10 3:25
Henry Minute4-Sep-10 3:25 
GeneralRe: Updating a progress bar in a loop Pin
Keith Vitali4-Sep-10 4:26
Keith Vitali4-Sep-10 4:26 
AnswerRe: Updating a progress bar in a loop Pin
PIEBALDconsult4-Sep-10 3:47
mvePIEBALDconsult4-Sep-10 3:47 
GeneralRe: Updating a progress bar in a loop Pin
Keith Vitali4-Sep-10 4:46
Keith Vitali4-Sep-10 4:46 
Questionhow many open connection is recommended to leave - in sql server 2008 Enterprise Edition Pin
Gali19784-Sep-10 1:23
Gali19784-Sep-10 1:23 
AnswerRe: how many open connection is recommended to leave - in sql server 2008 Enterprise Edition PinPopular
OriginalGriff4-Sep-10 1:45
mveOriginalGriff4-Sep-10 1:45 
AnswerRe: how many open connection is recommended to leave - in sql server 2008 Enterprise Edition Pin
PIEBALDconsult4-Sep-10 3:42
mvePIEBALDconsult4-Sep-10 3:42 
AnswerRe: how many open connection is recommended to leave - in sql server 2008 Enterprise Edition Pin
dan!sh 4-Sep-10 4:38
professional dan!sh 4-Sep-10 4:38 
GeneralRe: how many open connection is recommended to leave - in sql server 2008 Enterprise Edition Pin
PIEBALDconsult6-Sep-10 16:45
mvePIEBALDconsult6-Sep-10 16:45 

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.