Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

WinForms Designer DataGridViewComboBoxColumn problem using computed column

$
0
0

Hi, I open the WinForms designer of #D, add a DataGridView, set DataSource and DataMember to an existing DataTable pftexte, open the DGV designer in order to define the columns. The DataTable pftexte is defined by a typed dataset with field pfgid in relationship to the table pfgruppe. This table has fields klasse, kuerzel, name. After constructing the dataset, I add a column by the following code:

pfgruppe.Columns.Add("pf_gruppe", typeof(string), "klasse + '[' + kuerzel + ']' + name");

In the column designer, I want to change the default DGVTextBoxColumn showing pftexte.pfgid to a DGVComboBoxColumn showing pfgruppe.pf_gruppe. Unfortunately the column pf_gruppe isn't offered inside the designer. If I change the displaymember manually to "pf_gruppe" and close the column designer, #D gives the following exception.

Hope it helps. Juergen

 

SharpDevelop Version : 5.0.0.4755-c848dc28
.NET Version         : 4.5.51209
OS Version           : Microsoft Windows NT 6.1.7601 Service Pack 1
Current culture      : German (Germany) (de-DE)
Running under WOW6432, processor architecture: x86-64
Working Set Memory   : 494344kb
GC Heap Memory       : 186254kb

Exception thrown:
System.ArgumentException: Das Feld pf_gruppe ist nicht vorhanden.
   bei System.Windows.Forms.DataGridViewComboBoxCell.InitializeDisplayMemberPropertyDescriptor(String displayMember)
   bei System.Windows.Forms.DataGridViewComboBoxCell.OnDataGridViewChanged()
   bei System.Windows.Forms.DataGridView.OnAddingColumn(DataGridViewColumn dataGridViewColumn)
   bei System.Windows.Forms.DataGridViewColumnCollection.Add(DataGridViewColumn dataGridViewColumn)
   bei System.Windows.Forms.Design.DataGridViewColumnCollectionDialog.CommitChanges()
   bei System.Windows.Forms.Design.DataGridViewColumnCollectionDialog.okButton_Click(Object sender, EventArgs e)
   bei System.Windows.Forms.Control.OnClick(EventArgs e)
   bei System.Windows.Forms.Button.OnClick(EventArgs e)
   bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
   bei System.Windows.Forms.Button.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

---- Recent log messages:
12:59:53.393 [1] DEBUG - FormsDesigner loaded, setting ActiveDesignSurface to System.ComponentModel.Design.DesignSurface
12:59:53.413 [1] DEBUG - IDEContainer: Connecting property grid to service provider
12:59:53.543 [1] INFO - Form Designer: END INITIALIZE
12:59:53.543 [1] DEBUG - FormsDesigner view content activated, setting ActiveDesignSurface to System.ComponentModel.Design.DesignSurface
12:59:53.553 [1] DEBUG - ActiveContentChanged to ICSharpCode.FormsDesigner.FormsDesignerViewContent
12:59:53.573 [1] DEBUG - ParseInformationUpdated P:\SharpDevelop\Waldorf_Zeugnisse\source\MainForm.cs (updated)
12:59:53.573 [1] DEBUG - ParseInformationUpdated P:\SharpDevelop\Waldorf_Zeugnisse\source\MainForm.cs (updated)
12:59:53.573 [1] DEBUG - ParseInformationUpdated P:\SharpDevelop\Waldorf_Zeugnisse\source\MainForm.Designer.cs (updated)
12:59:53.833 [1] DEBUG - Folding update ignored; parse information is outdated version
12:59:53.833 [1] DEBUG - Folding update ignored; parse information is outdated version
13:03:22.194 [1] DEBUG - Forms designer: ComponentChanged: dataGridView1 [System.Windows.Forms.DataGridView], Member=Columns, OldValue=<null>, NewValue=<null>; Loading=False; Unloading=False
13:03:22.214 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.224 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.244 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.254 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.274 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.274 [1] DEBUG - Forms designer: Initializing nested service container of DataGridViewTextBoxColumn { Name=idDataGridViewTextBoxColumn3, Index=-1 } using Reflection
13:03:22.274 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.274 [1] DEBUG - Forms designer: Initializing nested service container of DataGridViewComboBoxColumn { Name=pfgIDDataGridViewTextBoxColumn, Index=-1 } using Reflection
13:03:22.284 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.284 [1] DEBUG - Forms designer: Initializing nested service container of DataGridViewComboBoxColumn { Name=schuelerIDDataGridViewTextBoxColumn, Index=-1 } using Reflection
13:03:22.284 [1] DEBUG - Forms designer: Component added/removed/renamed, Loading=False, Unloading=False
13:03:22.284 [1] DEBUG - Forms designer: ComponentChanged: DataGridViewTextBoxColumn { Name=idDataGridViewTextBoxColumn3, Index=-1 }, Member=DisplayIndex, OldValue=-1, NewValue=-1; Loading=False; Unloading=False
13:03:22.284 [1] DEBUG - Forms designer: ComponentChanged: DataGridViewComboBoxColumn { Name=pfgIDDataGridViewTextBoxColumn, Index=-1 }, Member=DisplayIndex, OldValue=-1, NewValue=-1; Loading=False; Unloading=False
13:03:22.524 [1] ERROR - ThreadException caught
--> Exception:
System.ArgumentException: Das Feld pf_gruppe ist nicht vorhanden.
   bei System.Windows.Forms.DataGridViewComboBoxCell.InitializeDisplayMemberPropertyDescriptor(String displayMember)
   bei System.Windows.Forms.DataGridViewComboBoxCell.OnDataGridViewChanged()
   bei System.Windows.Forms.DataGridView.OnAddingColumn(DataGridViewColumn dataGridViewColumn)
   bei System.Windows.Forms.DataGridViewColumnCollection.Add(DataGridViewColumn dataGridViewColumn)
   bei System.Windows.Forms.Design.DataGridViewColumnCollectionDialog.CommitChanges()
   bei System.Windows.Forms.Design.DataGridViewColumnCollectionDialog.okButton_Click(Object sender, EventArgs e)
   bei System.Windows.Forms.Control.OnClick(EventArgs e)
   bei System.Windows.Forms.Button.OnClick(EventArgs e)
   bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
   bei System.Windows.Forms.Button.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

---- Post-error application state information:
Installed 3rd party AddIns:
ProjectService.CurrentSolution: [Solution P:\SharpDevelop\Waldorf_Zeugnisse\Waldorf_Zeugnisse.sln with 1 projects]
ProjectService.CurrentProject: [CSharpProject: Waldorf_Zeugnisse]
Workbench.ActiveContent: ICSharpCode.FormsDesigner.FormsDesignerViewContent


Viewing all articles
Browse latest Browse all 1764

Trending Articles