Click here to Skip to main content
15,892,298 members
Home / Discussions / C#
   

C#

 
QuestionMulti threading in c# Pin
User-862169513-Apr-20 1:49
User-862169513-Apr-20 1:49 
AnswerRe: Multi threading in c# Pin
OriginalGriff13-Apr-20 3:00
mveOriginalGriff13-Apr-20 3:00 
QuestionOPC Client Using C# Titanium Library Pin
Member 147907399-Apr-20 20:17
Member 147907399-Apr-20 20:17 
AnswerRe: OPC Client Using C# Titanium Library Pin
Gerry Schmitz10-Apr-20 6:46
mveGerry Schmitz10-Apr-20 6:46 
GeneralRe: OPC Client Using C# Titanium Library Pin
Member 1479073910-Apr-20 7:03
Member 1479073910-Apr-20 7:03 
GeneralRe: OPC Client Using C# Titanium Library Pin
Mycroft Holmes10-Apr-20 12:35
professionalMycroft Holmes10-Apr-20 12:35 
AnswerRe: OPC Client Using C# Titanium Library Pin
Pete O'Hanlon14-Apr-20 5:42
mvePete O'Hanlon14-Apr-20 5:42 
Questiontextbox update Pin
_Q12_9-Apr-20 19:19
_Q12_9-Apr-20 19:19 
Inside a textbox i add many lines of data, ended with a newline(\r\n) for each of it.
For example:
Aaa
Bbb
Ccc
Each line must be read in a backgroundWorker1_DoWork event. Basically, is a time delay of a couple of seconds between jumping to the other line to be read and processed.

My problem is this: - If i add a new line, WHILE the DoWork is running, the textbox.List.lenght is bigger by 1. What should LOAD that updated List, and pass the next line consecutively, to the worker?
At this point i am blank.

What i did so far...
I inverted the list
why? because my processing is not disturbed by each new line added on top, but is accumulating lines at the end, maintaining the lines numbers and contents when it jumps to the next line.
C#
list1.Clear(); label1.Text = "";
list1.AddRange(textBox1.Lines);
list1.Reverse();
for (int i = 0; i < list1.Count; i++)
{
    label1.Text += list1[i] + nl;
}

And now the output is:
Ccc
Bbb-updateLine
Aaa
a1-nl
a2-nl

One solution to updating lines by mistake, and avoid re-processing them, is to completely erase the completed "worked" lines from the List and update somewhere else the finished lines.
AnswerRe: textbox update Pin
_Q12_9-Apr-20 21:20
_Q12_9-Apr-20 21:20 
AnswerRe: textbox update Pin
Gerry Schmitz10-Apr-20 6:43
mveGerry Schmitz10-Apr-20 6:43 
AnswerRe: textbox update Pin
BillWoodruff16-Apr-20 18:06
professionalBillWoodruff16-Apr-20 18:06 
QuestionUpate Exe Build Number Pin
Kevin Marois9-Apr-20 14:05
professionalKevin Marois9-Apr-20 14:05 
AnswerRe: Upate Exe Build Number Pin
Richard Deeming14-Apr-20 0:05
mveRichard Deeming14-Apr-20 0:05 
Questiontraversing two lists simultaneously Pin
Pita329-Apr-20 9:11
Pita329-Apr-20 9:11 
AnswerRe: traversing two lists simultaneously Pin
OriginalGriff9-Apr-20 9:29
mveOriginalGriff9-Apr-20 9:29 
AnswerRe: traversing two lists simultaneously Pin
Dave Kreskowiak9-Apr-20 9:31
mveDave Kreskowiak9-Apr-20 9:31 
AnswerRe: traversing two lists simultaneously Pin
Gerry Schmitz9-Apr-20 10:57
mveGerry Schmitz9-Apr-20 10:57 
AnswerRe: traversing two lists simultaneously Pin
James Curran13-Apr-20 1:14
James Curran13-Apr-20 1:14 
Question2 Async/Await Questions Pin
Kevin Marois8-Apr-20 18:10
professionalKevin Marois8-Apr-20 18:10 
AnswerRe: 2 Async/Await Questions Pin
Richard Deeming9-Apr-20 0:16
mveRichard Deeming9-Apr-20 0:16 
GeneralRe: 2 Async/Await Questions Pin
Kevin Marois9-Apr-20 6:22
professionalKevin Marois9-Apr-20 6:22 
QuestionGetting Text From External Application Pin
KiriGaya-Rye8-Apr-20 13:09
KiriGaya-Rye8-Apr-20 13:09 
QuestionHow to read/load a certificate stored in a JKS (Java key stores) file format, in .NET (C#) Pin
yuvraj vichare8-Apr-20 5:20
yuvraj vichare8-Apr-20 5:20 
AnswerRe: How to read/load a certificate stored in a JKS (Java key stores) file format, in .NET (C#) Pin
jkirkerx8-Apr-20 9:38
professionaljkirkerx8-Apr-20 9:38 
QuestionBackground Data Tables In C# Pin
Member 133258467-Apr-20 0:21
Member 133258467-Apr-20 0:21 

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.