Home All Groups Group Topic Archive Search About

ArgumentExceptionIsUnHandled

Author
1 Nov 2006 7:11 PM
Laurence
In VS.2005 Using VB.NET on a windows XP (sp2) fully patched.

I have a project that has a Microsoft DataGridView on it.
Occasionally, when I click on a column header, I get:

ArgumentExceptionIsUnHandled
At least one object must implement IComparable

this problem is Intermittent, it doesn't happen all the time,
but happens about once in every five clicks of the column header.

I am at a total loss as to what this could be.

Thanks in Advance,

Laurence

Here is the detail:

System.ArgumentException was unhandled
   Message="At least one object must implement IComparable."
   Source="mscorlib"
   StackTrace:
        at System.Collections.Comparer.Compare(Object a, Object b)
        at System.Windows.Forms.DataGridViewRowCollection.RowComparer.CompareObjects(Object value1, Object value2, Int32
rowIndex1, Int32 rowIndex2)
        at System.Windows.Forms.DataGridViewRowCollection.RowArrayList.CustomQuickSort(Int32 left, Int32 right)
        at System.Windows.Forms.DataGridViewRowCollection.Sort(IComparer customComparer, Boolean ascending)
        at System.Windows.Forms.DataGridView.SortInternal(IComparer comparer, DataGridViewColumn dataGridViewColumn,
ListSortDirection direction)
        at System.Windows.Forms.DataGridView.Sort(DataGridViewColumn dataGridViewColumn, ListSortDirection direction)
        at System.Windows.Forms.DataGridView.OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e)
        at System.Windows.Forms.DataGridView.OnMouseClick(MouseEventArgs e)
        at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
        at System.Windows.Forms.Control.WndProc(Message& m)
        at System.Windows.Forms.DataGridView.WndProc(Message& m)
        at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
        at System.Windows.Forms.Control.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.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
        at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
        at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
        at System.Windows.Forms.Application.Run(Form mainForm)
        at MiscellaneousProjects.frmSearch.Main() in C:\vbdev\MiscellaneousProjects\Client
Application\MiscellaneousProjects\MiscellaneousProjects\frmSearch.vb:line 3
        at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
        at System.Threading.ThreadHelper.ThreadStart()

Author
2 Nov 2006 2:11 AM
Larry
I found out what it was, you can't have cell without something in it,
even if you have nothing to put into it, you have to put system.dbnull.value
in the cell.


Laurence wrote:
Show quote
> In VS.2005 Using VB.NET on a windows XP (sp2) fully patched.
>
> I have a project that has a Microsoft DataGridView on it.
> Occasionally, when I click on a column header, I get:
>
> ArgumentExceptionIsUnHandled
> At least one object must implement IComparable
>
> this problem is Intermittent, it doesn't happen all the time,
> but happens about once in every five clicks of the column header.
>
> I am at a total loss as to what this could be.
>
> Thanks in Advance,
>
> Laurence
>
> Here is the detail:
>
> System.ArgumentException was unhandled
>   Message="At least one object must implement IComparable."
>   Source="mscorlib"
>   StackTrace:
>        at System.Collections.Comparer.Compare(Object a, Object b)
>        at
> System.Windows.Forms.DataGridViewRowCollection.RowComparer.CompareObjects(Object
> value1, Object value2, Int32 rowIndex1, Int32 rowIndex2)
>        at
> System.Windows.Forms.DataGridViewRowCollection.RowArrayList.CustomQuickSort(Int32
> left, Int32 right)
>        at System.Windows.Forms.DataGridViewRowCollection.Sort(IComparer
> customComparer, Boolean ascending)
>        at System.Windows.Forms.DataGridView.SortInternal(IComparer
> comparer, DataGridViewColumn dataGridViewColumn, ListSortDirection
> direction)
>        at System.Windows.Forms.DataGridView.Sort(DataGridViewColumn
> dataGridViewColumn, ListSortDirection direction)
>        at
> System.Windows.Forms.DataGridView.OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs
> e)
>        at System.Windows.Forms.DataGridView.OnMouseClick(MouseEventArgs e)
>        at System.Windows.Forms.Control.WmMouseUp(Message& m,
> MouseButtons button, Int32 clicks)
>        at System.Windows.Forms.Control.WndProc(Message& m)
>        at System.Windows.Forms.DataGridView.WndProc(Message& m)
>        at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
>        at
> System.Windows.Forms.Control.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.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
> dwComponentID, Int32 reason, Int32 pvLoopData)
>        at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
> reason, ApplicationContext context)
>        at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
> reason, ApplicationContext context)
>        at System.Windows.Forms.Application.Run(Form mainForm)
>        at MiscellaneousProjects.frmSearch.Main() in
> C:\vbdev\MiscellaneousProjects\Client
> Application\MiscellaneousProjects\MiscellaneousProjects\frmSearch.vb:line 3
>        at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
> args)
>        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
>        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>        at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>        at System.Threading.ThreadHelper.ThreadStart()
>

AddThis Social Bookmark Button