[Mono-list] WinForms DataGridView does not add a new Row

Stifu stifu at free.fr
Wed Apr 21 02:01:29 EDT 2010


It's most likely a Mono WinForms bug.

It doesn't look like it's been reported (using this as reference:
https://bugzilla.novell.com/buglist.cgi?query_format=advanced&short_desc=DataGridView&bug_status=NEW&bug_status=ASSIGNED&bug_status=NEEDINFO&bug_status=REOPENED&short_desc_type=allwordssubstr),
so feel free to file a bug report for it.


Costantino Pipero wrote:
> 
> 
> I have a very simple Winform app that I want to use to show the  
> cross-platform development.
> 
> Basically, it's a WinForm DataGrid with 2 buttons that loads/change/save  
> to and from an XML file.
> 
> It's pretty straight forward, and works perfectly in VS in Windows. It  
> compiles and run in Mono and openSuse 11.2, but the DataGrid doesn't add  
> the new blank row at the bottom that allows to enter new data (like it  
> does in Windows).
> 
> Here's the form code
> 
> 
> 
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Text;
> using System.Windows.Forms;
> 
> namespace MonoWinForms
> {
>      public partial class Form1 : Form
>      {
>          const string dataFile = "Contacts.xml";
> 
>          public Form1()
>          {
>              InitializeComponent();
>          }
> 
>          private void Form1_Load(object sender, EventArgs e)
>          {
>              if (System.IO.File.Exists(dataFile)) LoadData();
>              else CreateData();
>          }
> 
> 
>          private void LoadData()
>          {
>              dsContacts.ReadXml(dataFile);
>          }
> 
>          private void CreateData()
>          {
>              dsContacts.Contacts.AddContactsRow("<First Name>", "<Last  
> Name>", "");
>              dsContacts.WriteXml(dataFile, XmlWriteMode.WriteSchema);
>          }
> 
>          private void btnSave_Click(object sender, EventArgs e)
>          {
>              dsContacts.Contacts.AcceptChanges();
>              dsContacts.Contacts.WriteXml(dataFile,  
> XmlWriteMode.WriteSchema);
>          }
> 
>          private void btnDelete_Click(object sender, EventArgs e)
>          {
>              dataGridView1.Rows.RemoveAt(dataGridView1.CurrentRow.Index);
>              btnSave_Click(sender, e);
>          }
> 
> 
> 
>      }
> }
> 
> 
> 
> 
> 
> Thanks for you help, I can send the whole VS solution if it helps (for the  
> designer and the dataset)...
> 
> Cos
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 

-- 
View this message in context: http://n4.nabble.com/WinForms-DataGridView-does-not-add-a-new-Row-tp2018399p2018417.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list