Click here to Skip to main content
15,894,405 members
Home / Discussions / Windows Forms
   

Windows Forms

 
Questionexpanding label control Pin
abdelhameed817-Nov-07 0:37
abdelhameed817-Nov-07 0:37 
AnswerRe: expanding label control Pin
Christian Graus7-Nov-07 9:43
protectorChristian Graus7-Nov-07 9:43 
QuestionDataGridView and Generics Pin
Ponzano Paolo5-Nov-07 23:44
Ponzano Paolo5-Nov-07 23:44 
AnswerRe: DataGridView and Generics Pin
Christian Graus5-Nov-07 23:53
protectorChristian Graus5-Nov-07 23:53 
GeneralRe: DataGridView and Generics Pin
Ponzano Paolo6-Nov-07 0:29
Ponzano Paolo6-Nov-07 0:29 
GeneralRe: DataGridView and Generics Pin
Pete O'Hanlon6-Nov-07 1:11
mvePete O'Hanlon6-Nov-07 1:11 
GeneralRe: DataGridView and Generics Pin
Ponzano Paolo6-Nov-07 1:13
Ponzano Paolo6-Nov-07 1:13 
GeneralRe: DataGridView and Generics Pin
Ponzano Paolo6-Nov-07 1:34
Ponzano Paolo6-Nov-07 1:34 
ok, now that the problem has been fixed we've another one that came out, and for this I need your help at all!!!

This is the main form event :

  private void Form1_Load(object sender, EventArgs e)<br />
    {<br />
      myWorker = new Worker();<br />
      dataGridView1.ReadOnly = false;<br />
<br />
      dataGridView1.DataSource = myWorker.myList;<br />
<br />
      Thread myThread = new Thread(new ThreadStart(myWorker.DoWork));<br />
<br />
      myThread.Start();<br />
    }


The Worker class is this one :

  public class Worker<br />
  {<br />
    public BindingList<Product> myList = new BindingList<Product>();<br />
<br />
    public void DoWork()<br />
    {<br />
      Random r = new Random();<br />
      for(int i=0; i<1000; i++)<br />
      {<br />
        myList.Add(new Product("Test",r.Next(),r.Next()));<br />
        Thread.Sleep(1000);<br />
      }<br />
    }<br />
  }<br />


At the myList.Add(...) I get an exception of type "Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on."

But this happen in a Business Object not in a Window's Control. I suppose this's because of the datagridview.Datasource property set, but how can I fix it?

Thanks in advance,
Bests
QuestionC# Soap and HTTP Pin
AssemblySoft5-Nov-07 6:16
AssemblySoft5-Nov-07 6:16 
Answercross-post Pin
Luc Pattyn5-Nov-07 6:40
sitebuilderLuc Pattyn5-Nov-07 6:40 
JokeRe: cross-post Pin
Paul Conrad6-Nov-07 16:00
professionalPaul Conrad6-Nov-07 16:00 
QuestionList View Pin
Roberto Pereira3-Nov-07 10:38
Roberto Pereira3-Nov-07 10:38 
AnswerRe: List View Pin
Paul Conrad3-Nov-07 12:53
professionalPaul Conrad3-Nov-07 12:53 
GeneralRe: List View Pin
Roberto Pereira5-Nov-07 8:31
Roberto Pereira5-Nov-07 8:31 
GeneralRe: List View Pin
Paul Conrad6-Nov-07 16:00
professionalPaul Conrad6-Nov-07 16:00 
QuestionCombobox in DatagridView Pin
metbinu2003@yahoo.com2-Nov-07 21:36
metbinu2003@yahoo.com2-Nov-07 21:36 
QuestiondataGridview Cell string as an input text Pin
basi00142-Nov-07 4:40
basi00142-Nov-07 4:40 
AnswerRe: dataGridview Cell string as an input text Pin
Giorgi Dalakishvili2-Nov-07 6:54
mentorGiorgi Dalakishvili2-Nov-07 6:54 
GeneralRe: dataGridview Cell string as an input text Pin
basi00145-Nov-07 6:31
basi00145-Nov-07 6:31 
GeneralColorEditor in ComboBox Pin
Brady Kelly2-Nov-07 2:49
Brady Kelly2-Nov-07 2:49 
GeneralRe: ColorEditor in ComboBox Pin
Christian Graus7-Nov-07 9:45
protectorChristian Graus7-Nov-07 9:45 
GeneralRe: ColorEditor in ComboBox Pin
Brady Kelly7-Nov-07 18:20
Brady Kelly7-Nov-07 18:20 
QuestionAppbars on multiple monitors Pin
RichardM12-Nov-07 2:20
RichardM12-Nov-07 2:20 
GeneralCustom Grid: Multiple data tables Pin
Brady Kelly1-Nov-07 22:38
Brady Kelly1-Nov-07 22:38 
QuestionPictureBox and mem usage Pin
2hdass31-Oct-07 9:45
2hdass31-Oct-07 9: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.