2009-01-03 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Fri, 2 Jan 2009 22:45:56 +0000 (22:45 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Fri, 2 Jan 2009 22:45:56 +0000 (22:45 -0000)
* DataGridViewCell.cs: We should return a value even if we are not bound
to a DataGridView.

svn path=/trunk/mcs/; revision=122357

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs

index 50afdc827acb140b5a3585e2a88508a772740ffb..21cafc145363148b88a3c6d29b57a886a99881dc 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-03  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * DataGridViewCell.cs: We should return a value even if we are not bound 
+       to a DataGridView.
+
 2009-01-02  Ivan N. Zlatev  <contact@i-nz.net>
 
        * CurrencyManager.cs, DataGrid.cs: 
index 7ff4185eb67d4be454c9caa5f3f987242fae0819..08cac600695235fac713d9599154491fdd1cf0f8 100644 (file)
@@ -900,10 +900,7 @@ namespace System.Windows.Forms {
                }
 
                protected virtual object GetValue (int rowIndex) {
-                       if (DataGridView == null)
-                               return null;
-
-                       if (RowIndex < 0 || RowIndex >= DataGridView.Rows.Count)
+                       if (DataGridView != null && (RowIndex < 0 || RowIndex >= DataGridView.Rows.Count))
                                throw new ArgumentOutOfRangeException ("rowIndex", "Specified argument was out of the range of valid values.");
                                
                        if (DataProperty != null)
@@ -913,7 +910,8 @@ namespace System.Windows.Forms {
                                return valuex;
 
                        DataGridViewCellValueEventArgs dgvcvea = new DataGridViewCellValueEventArgs (columnIndex, rowIndex);
-                       DataGridView.OnCellValueNeeded (dgvcvea);
+                       if (DataGridView != null)
+                               DataGridView.OnCellValueNeeded (dgvcvea);
                        return dgvcvea.Value;
                }