Click here to Skip to main content
15,885,278 members

Comments by Member 13174280 (Top 12 by date)

Member 13174280 28-Jan-21 11:11am View    
thanks I'm at my first experiments with Parallel, applying the suggestions the loop is completed as long as I don't associate a control to another one.

limited the number of threads to 2

var options = new ParallelOptions()
{
MaxDegreeOfParallelism = 2
};

with association pnlCatalogo.Controls.Add(nDia[i]) , Cross-threading exception is guaranteed.

public void TestCornici(int i, Panel pnlImmagini)
{
numeroDia[i] = new Label();
pnlCatalogo.Controls.Add(numeroDia[i]); --> Cross-threading exception

.... without association
//pnlCatalogo.Controls.Add(numeroDia[i]); --> correct cycle
numeroDia[i].BorderStyle = BorderStyle.None;
.....
}
Member 13174280 28-Jan-21 11:04am View    
I limited the number of threads to 2

var options = new ParallelOptions()
{
MaxDegreeOfParallelism = 2
};

the cycle is executed correctly if I exclude: pnlCatalogo.Controls.Add(nDia[i])

nDia[i] = new Label();
//pnlCatalogo.Controls.Add(nDia[i]); --> exclude
nDia[i].BorderStyle = BorderStyle.None;
........

why the exception occurs associating a control (Label) to an other (Panel)?
Member 13174280 29-Nov-20 3:52am View    
just know the position of the cursor while dragging.
I am trying the solution by dragleave event
Member 13174280 9-Dec-19 13:44pm View    
this routine solve then \n

string newLine = Environment.NewLine;
int at = 0;
string app;
string app1 = "";

while (s.Length > 0)
{
at = s.IndexOf("\n");
app = s.Substring(0, at) + newLine;
s = s.Substring(at + 1);
app1 = app1 + app;
}

textBox1.Text = app1;

now show
line1
line2
...
linex
Member 13174280 9-Dec-19 12:32pm View    
ok, thanks; my error on row
this is correct.

DataTable dtFoto = new DataTable();
dtFoto = gesdb.QryRead(conn, dtFoto, Query); //execute query

MemoryStream ms;

int x = 0;
foreach (DataRow row in dtFoto.Rows)
{
FileImg = row["description"].ToString();

byte[] byteBLOBData = (Byte[])(row["public_note"]);
textBox1.Text = Encoding.UTF8.GetString(byteBLOBData);
}

then Blob is
line1
line2
...
the result is line1/nline2/nline3/n
texBox1 does not apply the /n
and show line1line2line3