Click here to Skip to main content
16,016,140 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Newbie, Database Programming Pin
trønderen24-Jun-24 8:08
trønderen24-Jun-24 8:08 
GeneralRe: C# Newbie, Database Programming Pin
Richard MacCutchan24-Jun-24 9:33
mveRichard MacCutchan24-Jun-24 9:33 
AnswerRe: C# Newbie, Database Programming Pin
Member 1527072924-Jun-24 9:01
Member 1527072924-Jun-24 9:01 
QuestionWhere To Find This DLL Pin
Kevin Marois11-Jun-24 17:57
professionalKevin Marois11-Jun-24 17:57 
AnswerRe: Where To Find This DLL Pin
Dave Kreskowiak11-Jun-24 18:29
mveDave Kreskowiak11-Jun-24 18:29 
AnswerRe: Where To Find This DLL Pin
OriginalGriff11-Jun-24 18:49
mveOriginalGriff11-Jun-24 18:49 
AnswerRe: Where To Find This DLL Pin
Ravi Bhavnani16-Jun-24 8:18
professionalRavi Bhavnani16-Jun-24 8:18 
QuestionHow to update UI control inside Parallel.ForEach ? Pin
Martin Adams 20232-Jun-24 12:04
Martin Adams 20232-Jun-24 12:04 
Hi
I am trying to use Parallel.ForEach with ConcurrentBag and it work but to display a feedback I used progessbar control to display fname value , problem after few seconds I get error and the error message is not visible instead a wight box appear because of using a thread . any idea what is the problem in this code ?


int row_idx = 1;
ConcurrentBag<(int, string, float)> bag = new ConcurrentBag<(int, string, float)>();
Parallel.ForEach(elements, element =>
{

    string fname = element.name;
    float ftrack = (float)(element.track);


    var elementsToAdd = new (int, string, float)[]
    {
        (row_idx, fname, fsize)
    };

    bag.Add(elementsToAdd[0]);

    row_idx++;

    ProgressBar1.Text = fname; // <<---- error here
    ProgressBar1.Update();
    //Application.DoEvents();

});

AnswerRe: How to update UI control inside Parallel.ForEach ? Pin
Dave Kreskowiak2-Jun-24 13:03
mveDave Kreskowiak2-Jun-24 13:03 
GeneralRe: How to update UI control inside Parallel.ForEach ? Pin
Martin Adams 20232-Jun-24 13:24
Martin Adams 20232-Jun-24 13:24 
QuestionNeed Help with Optimizing My C# Code for Better Performance Pin
Steves Smith31-May-24 1:25
Steves Smith31-May-24 1:25 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
charlieg31-May-24 1:34
charlieg31-May-24 1:34 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Richard Deeming31-May-24 1:44
mveRichard Deeming31-May-24 1:44 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Maximilien31-May-24 1:56
Maximilien31-May-24 1:56 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
abmv31-May-24 2:23
professionalabmv31-May-24 2:23 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
OriginalGriff31-May-24 2:39
mveOriginalGriff31-May-24 2:39 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
PIEBALDconsult31-May-24 2:52
mvePIEBALDconsult31-May-24 2:52 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Dave Kreskowiak31-May-24 12:39
mveDave Kreskowiak31-May-24 12:39 
GeneralRe: Need Help with Optimizing My C# Code for Better Performance Pin
trønderen8-Jun-24 5:22
trønderen8-Jun-24 5:22 
GeneralRe: Need Help with Optimizing My C# Code for Better Performance Pin
Dave Kreskowiak8-Jun-24 6:42
mveDave Kreskowiak8-Jun-24 6:42 
GeneralRe: Need Help with Optimizing My C# Code for Better Performance Pin
trønderen9-Jun-24 3:35
trønderen9-Jun-24 3:35 
GeneralRe: Need Help with Optimizing My C# Code for Better Performance Pin
Dave Kreskowiak9-Jun-24 4:08
mveDave Kreskowiak9-Jun-24 4:08 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Rob Philpott4-Jun-24 2:00
Rob Philpott4-Jun-24 2:00 
GeneralRe: Need Help with Optimizing My C# Code for Better Performance Pin
jochance7-Jun-24 2:28
jochance7-Jun-24 2:28 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
jschell7-Jun-24 12:41
jschell7-Jun-24 12:41 

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.