I am sorry,I have poor english..
Two Class file is located below one namespace..
it is no error..
namespace Convert (namespace name)
WinForm (first class name)
ColumnSorter (second class name)
but, i make ColumnSorter.dll file(at class library project)
this dll file is second class file..
and compile this project, view below error
error message---------------------------------
at ColumnSort1.ColumnSorter.Compare(Object x, Object y)
at System.Windows.Forms.ListView.CompareFunc(IntPtr lparam1, IntPtr
lparam2, IntPtr lparamSort)
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ListView.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
-----------------------------------------------
WinForm class file -----------------
using ColumnSort1;
...............
ColumnSorter csort=new ColumnSorter();
...............
DataList.ListViewItemSorter=csort; // for DataList column sort
--------------------------------------------------------
columnsort.cs file(maked dll file) ------------
namespace ColumnSort1
{
public enum Sorting { Ascending, Descending };
public class ColumnSorter:IComparer{
public int currentColumn = -1; //
public int previousColumn = -1; //
public Sorting sort = Sorting.Ascending;
public int Compare(object x, object y)
{
ListViewItem rowA = (ListViewItem)x;
ListViewItem rowB = (ListViewItem)y;
int result=0;
switch(sort)
{
case Sorting.Ascending: //
result =
String.Compare(rowA.SubItems[currentColumn].Text,rowB.SubItems[currentColumn
].Text);
break;
case Sorting.Descending: //
result =
String.Compare(rowB.SubItems[currentColumn].Text,rowA.SubItems[currentColumn
].Text);
break;
}
return result;
}
}
}
----------------------------------------------------------------------------
i don't know what problem..
Any help will be appreciated.
Thanks