[Mono-bugs] [Bug 650140] New: rowCount / Rows.Count is 0 after DataGridView.DataSource is assigned

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 29 04:08:24 EDT 2010



           Summary: rowCount / Rows.Count is 0 after
                    DataGridView.DataSource is assigned
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: markus.jesner at winnotech.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:
Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)

I habe a DataGridView. When I assign a BindingSource (List<object> as
DataSource) to the DataGridView and I print out the RowCount I get 0. The
DataGridView fills the Columns/Rows with the Data.


List<string> dataList = new List<string>();

dataList.Add("string 1");
dataList.Add("string 2");
dataList.Add("string 3");
dataList.Add("string 4");
dataList.Add("string 5");

BindingSource bs = new BindingSource();
bs.DataSource = dataList;

DataGridView dgv = new DataGridView();
dgv.DataSource = bs; // assign binding source to datagridview

Console.WriteLine("rows:" + dgv.RowCount); // here I get 0 but the DataGridView
hast 1 Column and 5 Rows (with "string1", ...)

I also tried to create my own DataGridView. When I override the OnPaint Method,
then the RowCount is 5. When I override the OnDataSourceChanged Method the
RowCount is 0.

Reproducible: Always

Steps to Reproduce:
1. Add BindingSource to DataGridView
2. Print out RowCount or Rows.Count (of the DataGridView)

Expected Results:  
RowCount / Rows.Count should not be 0 after assigning a DataSource (>0 items)

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list