Home Forums WinForms controls Xceed Grid for WinForms How to use begininvoke to bind gridcontrol?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #15616 |

    i use grid 3.6.When i use begininvoke to bind the gridcontrol,I often meet a exception which show
    “Index (zero based) must be greater than or equal to zero and less than the size of the argument list”
    But if I use a general DataGridView to show my data,there will be none exception.If I just
    use UI thread to get data and bind the gridcontrol,there will be none exception too.
    my code:

    delegate void MyDeletegate();
    string connString = “server=.;uid=sa;pwd=speed;database=Northwind”;

    private void button5_Click(object sender, EventArgs e)
    Thread t = new Thread(new ThreadStart(ThreadBind));
    t.Name = “NewThread”;

    private void ThreadBind()
    this.BeginInvoke(new MyDeletegate(BindGrid));

    private void BindGrid()
    SqlConnection sqlconn = new SqlConnection(connString);

    SqlDataAdapter adp = new SqlDataAdapter(“SELECT * FROM Products”, sqlconn);
    SqlCommandBuilder sqlcomm = new SqlCommandBuilder(adp);

    DataSet ds = new DataSet();
    BindingSource bs = new BindingSource();
    this.dataGridView1.DataSource = bs;

    Can you tell me what’s the reason?How can I get the large data in another thread and bind the gridcontrol?

    Imported from legacy forums. Posted by handsomesun (had 2037 views)

    Xceed Support
    Post count: 5658

    Are you using our <a href=”http://download3.xceedsoft.com/Packages/3.0.7326.14130/XceedComponents.exe”>latest</a&gt; version?

    If not, this should solve your issue.

    Imported from legacy forums. Posted by CharlesB (had 3040 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.