Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Daspit <damien_daspit@sil.org>2015-02-10 11:46:18 +0300
committerEberhard Beilharz <eb1@sil.org>2015-02-10 11:59:50 +0300
commitf7593c22b0dc14969cc075997ae2533d2972f633 (patch)
tree8ba4c3329441946e6253ca9c92f2087465e400ae /mcs/class/Managed.Windows.Forms/System.Windows.Forms
parenta74bac2da2923bf7436bb7e2bef3fabe510f308d (diff)
[MWF] Fix NullReferenceException introduced by commit a080a7d
Change-Id: I5709063cc7eecc01fd1e2978cd8aac096060c31e
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms')
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
index 9724a269c74..d5b65806e71 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
@@ -38,10 +38,8 @@ namespace System.Windows.Forms {
void CreateEditingControl ()
{
editingControl = new DataGridViewTextBoxEditingControl() {
- EditingControlDataGridView = DataGridView,
Multiline = false,
- BorderStyle = BorderStyle.None,
- MaxLength = maxInputLength
+ BorderStyle = BorderStyle.None
};
}
@@ -92,8 +90,13 @@ namespace System.Windows.Forms {
throw new InvalidOperationException("There is no associated DataGridView.");
}
- CreateEditingControl ();
+ if (editingControl == null)
+ CreateEditingControl ();
+
DataGridView.EditingControlInternal = editingControl;
+
+ editingControl.EditingControlDataGridView = DataGridView;
+ editingControl.MaxLength = maxInputLength;
if (initialFormattedValue == null || initialFormattedValue.ToString () == string.Empty)
editingControl.Text = string.Empty;
@@ -126,6 +129,9 @@ namespace System.Windows.Forms {
public override void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow)
{
+ if (editingControl == null)
+ CreateEditingControl ();
+
cellBounds.Size = new Size (cellBounds.Width - 5, cellBounds.Height + 2);
cellBounds.Location = new Point (cellBounds.X + 3, ((cellBounds.Height - editingControl.Height) / 2) + cellBounds.Y - 1);