We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exception after deleting a record bound to griddataboudgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

29435 May 25,2005 02:47 PM UTC May 26,2005 12:18 PM UTC WinForms 3
loading
Tags: GridControl
Christian Pogea
Asked On May 25, 2005 02:47 PM UTC

i moved to syncfusion 3.2.0.1 and now i get an exception, if i delete a row in the griddataboundgrid and push any button. it can also be a button without any handling. System.Exception: DataBinding konnte keine Zeile in der Liste finden, die für alle Bindungen verwendet werden kann. at System.Windows.Forms.CurrencyManager.FindGoodRow() at System.Windows.Forms.CurrencyManager.CurrencyManager_PushData() at System.Windows.Forms.CurrencyManager.OnItemChanged(ItemChangedEventArgs e) at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e) at System.Windows.Forms.CurrencyManager.Refresh() at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnValidating(CancelEventArgs e) at System.Windows.Forms.Control.NotifyValidating() at System.Windows.Forms.ContainerControl.ValidateThroughAncestor(Control ancestorControl) at System.Windows.Forms.ContainerControl.EnterValidation(Control enterControl) at System.Windows.Forms.ContainerControl.UpdateFocusedControl() at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value) at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator) at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control) at System.Windows.Forms.Control.WmSetFocus(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.SetFocus(HandleRef hWnd) at System.Windows.Forms.Control.FocusInternal() at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at AMS.Form1.Main() in d:\dotnet\ams\form1.cs:line 1157

Administrator [Syncfusion]
Replied On May 25, 2005 03:24 PM UTC

Do you delete the row by clicking a row header and pressing the delete key? Can you reproduce this in one of our samples, or can you post a sample with the problem?

Christian Pogea
Replied On May 25, 2005 05:36 PM UTC

bug1_4410.zip use the attached sample. select the first row, press the delete key and push the "speichern" button and then you get the exception.

Administrator [Syncfusion]
Replied On May 26, 2005 12:18 PM UTC

When you press delete the following code gets executed:
public virtual void RemoveRecords(int first, int last)
{

	TraceUtil.TraceCurrentMethodInfoIf(Switches.Development.TraceVerbose,
		first, last);
	inRemoveRecords = true;
	try
	{
		if (List != null &&
			GridListUtil.GetAllowRemove(List))
		{

			gridModel.BeginUpdate(BeginUpdateOptions.InvalidateAndScroll);
			for (int index = last; index >=
				first; index--)
			{
				if (listManager != null)

					ListManager.RemoveAt(index);
				else

					List.RemoveAt(index);
			}
			if (this.bindToCurrencyManager)

				this.listManager_PositionChanged(ListManager, EventArgs.Empty);

			this.OnRowChanged(EventArgs.Empty);

			this.OnRecordsRemoved(EventArgs.Empty);
			gridModel.EndUpdate(true);
		}
	}
	finally
	{
		inRemoveRecords = false;
	}
}
The exception gets thrown when ListManager.RemoveAt(index); Is called. It is the following exception: A first chance exception of type ''System.ArgumentException'' occurred in system.windows.forms.dll Additional information: ''1/1/0001 12:00:00 AM'' is not a valid value for ''Value''. ''Value'' should be between ''MinDate'' and ''MaxDate''. With the following call stack: system.windows.forms.dll!System.Windows.Forms.DateTimePicker.set_Value(System.DateTime value = {1/1/1}) + 0x173 bytes system.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(System.Object component = {Value={12/30/9998}}, System.Object value =) + 0x189 bytes system.windows.forms.dll!System.Windows.Forms.Binding.SetPropValue(System.Object value = ) + 0x101 bytes system.windows.forms.dll!System.Windows.Forms.Binding.PushData()+ 0x50 bytes system.windows.forms.dll!System.Windows.Forms.BindingManagerBase.PushData() + 0x59 bytes system.windows.forms.dll!System.Windows.Forms.CurrencyManager.CurrencyManager_PushData() + 0x47 bytes system.windows.forms.dll!System.Windows.Forms.CurrencyManager.OnItemChanged(System.Windows.Forms.ItemChangedEventArgs e = {Index=-1}) + 0x78 bytes system.windows.forms.dll!System.Windows.Forms.CurrencyManager.UpdateIsBinding(bool force = false) + 0x122 bytes system.windows.forms.dll!System.Windows.Forms.CurrencyManager.UpdateIsBinding() + 0xd bytes system.windows.forms.dll!System.Windows.Forms.CurrencyManager.List_ListChanged(System.Object sender = {System.Data.DataView},System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x133 bytes system.data.dll!System.Data.DataView.OnListChanged(System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs})+ 0x48 bytes system.data.dll!System.Data.DataView.IndexListChanged(System.Object sender = {System.Data.Index}, System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x43 bytes system.data.dll!System.Data.DataView.FireEvent(System.Data.TargetEvent targetEvent = IndexListChanged, System.Object sender = {System.Data.Index}, System.EventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x4c bytes system.data.dll!System.Data.DataViewListener.IndexListChanged(System.Object sender = {System.Data.Index}, System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x3d bytes system.data.dll!System.Data.Index.OnListChanged(System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x29 bytes system.data.dll!System.Data.Index.DeleteRecord(int recordIndex = 0) + 0x4d bytes system.data.dll!System.Data.Index.ApplyChangeAction(int record = 0, int action = -1) + 0x73 bytes system.data.dll!System.Data.Index.RecordStateChanged(int record = 0, System.Data.DataViewRowState oldState = Added, System.Data.DataViewRowState newState = None) + 0x34 bytes system.data.dll!System.Data.DataTable.RecordStateChanged(int record1 = 0, System.Data.DataViewRowState oldState1 = Added, System.Data.DataViewRowState newState1 = None, int record2 = -1, System.Data.DataViewRowState oldState2 = None, System.Data.DataViewRowState newState2 = None) + 0xc0 bytes system.data.dll!System.Data.DataTable.SetNewRecord(System.Data.DataRow row = {System.Data.DataRow}, int proposedRecord = -1, System.Data.DataRowAction action = Delete, bool isInMerge = false) + 0x230 bytes system.data.dll!System.Data.DataTable.DeleteRow(System.Data.DataRow row = {System.Data.DataRow}) + 0x32 bytes system.data.dll!System.Data.DataRow.Delete() + 0x3f bytes system.data.dll!System.Data.DataView.Delete(int index = 0) + 0x80 bytes system.data.dll!System.Data.DataView.System.Collections.IList.RemoveAt(int index = 0) + 0x16 bytes system.windows.forms.dll!System.Windows.Forms.CurrencyManager.RemoveAt(int index = 0) + 0x1b bytes syncfusion.grid.windows.dll!Syncfusion.Windows.Forms.Grid.GridModelDataBinder.RemoveRecords(int first = 0, int last = 0) Line 2955 + 0x14 bytes The reason for this exception is that the DateTimePicker is bound to the same ListManager as the grid. When the grid removes the only record by calling ListManager.Remove the ListManager resets all values for the record and notifies all controls that are bound to the ListManager. Therefore it also notifies the DateTimePicker and assign a null value to it. The DateTimePicker then throws an exception. You can workaround the problem by making sure that one row remains in the CurrencyManager when you delete the last row. In the bmb_PositionChanged you can check for CurrenyManager.Count = 0
private void bmb_PositionChanged(object sender, EventArgs e)
{
	CurrencyManager cm = sender as CurrencyManager;
	if (cm != null && cm.Count == 0)
	{
		this.NewSerienauftrag(0);
	}
	RefreshRadioButtons();
	BeginEnableDisable();
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;