[Mono-bugs] [Bug 476835] New: DataGridView doesn't update when dataSource is a list

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 17 23:20:20 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=476835


           Summary: DataGridView doesn't update when dataSource is a list
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: i586
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jkboulder at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6)
Gecko/2009011913 Firefox/3.0.6

When I call the dataGridView1.Refresh() method after changing values in the
list that serves as the data source for the dataGridView1, the form updates
correctly when running in .NET environment on XP, but it doesn't update at all
when running under the Mono 2.2/OpenSUSE LiveCD. 

The following simplified test case shows how the the data source values are
changed in a timer event callback which then calls dataGridView1.Refresh() to
update the grid control on the form. The displayed seconds and minutes in the
first and second rows should count up.

  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    Timer Timer1;
    // Data to be shown in dataGridView1
    private List<MyData> myData = new List<MyData>();

    private void Form1_Load(object sender, EventArgs e)
    {
      myData.Add(new MyData("Seconds", 1));
      myData.Add(new MyData("Minutes", 1));

      // Set DataGridView DataSource to autogenerate columns and display data.
      dataGridView1.DataSource = myData;

      for (int i = 0; i < 2; i++) {
        dataGridView1.Columns[i].Width = 60;
      }
      Timer1 = new Timer();
      Timer1.Tick += new EventHandler(Timer1_Tick);
      Timer1.Interval = 1000; // Fire once a second`
      Timer1.Start();
    }

    // This executes once a second to update the DataGridView control
    private void Timer1_Tick(object sender, EventArgs e)
    {
      Timer1.Stop();
      if (++myData[0].Val >= 60) { // Change the data
        myData[0].Val = 1;         // Seconds
        myData[1].Val++;           // Minutes
      }
      dataGridView1.Refresh(); // Show the new data
      Timer1.Start();
    }

  }

  public class MyData
  {
    public String Name { get; set; }
    public int Val { get; set; }

    public MyData(String name, int val)
    {
      this.Name = name;
      this.Val = val;
    }
  }



Reproducible: Always

Steps to Reproduce:
1.Run CCS-MODBUS.exe from a shell in the Mono 2.2 LiveCD under OpenSuse 11.0 by
typing: mono CCS-MODBUS.exe
2.
3.
Actual Results:  
Form appears with dataGridView but the displayed seconds (first row, second
column) and the minutes (second row, second column) never change from their
initial values of 1.

Expected Results:  
The displayed seconds should change every second and the displayed minutes
should change every minute.

-- 
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