Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim QueryReOrder = From Q In Query _
- Where ((0 - Q.Qualifier) / cmbTSStakeValue.Text) <= 0.1 _
- Order By Q.Qualifier Descending _
- Select Q
- Dim bs As New BindingSource
- bs.DataSource = QueryReOrder
- DGFindMatch.DataSource = bs
- Sort Nothing String
- SortProperty Nothing System.ComponentModel.PropertyDescriptor
- SupportsAdvancedSorting False Boolean
- SupportsChangeNotification True Boolean
- SupportsFiltering False Boolean
- SupportsSearching False Boolean
- SupportsSorting False Boolean
- //I know that you asked the question in VB.NET but I don't know the syntax that well.
- public class SortableBindingList<T> : BindingList<T>
- {
- //override necessary sort core methods
- }
- SortableBindingList<string> list = new SortableBindingList<string>(QueryReOrder.ToList());
- //use list as your DataSource now
- var query = from o in m_ds.Objective
- join ot in m_ds.ObjectiveType on o.ObjectiveTypeId equals ot.Id
- join dst in m_ds.DevelopmentStatusType on o.DevelopmentStatusTypeId equals dst.Id
- join rt in m_ds.ResultType on o.PrecedenceResultTypeId equals rt.Id
- select new
- {
- o.Id,
- type = ot.Description,
- precedence = rt.Description,
- o.Symbol,
- o.Title,
- };
- public static DataTable DataTableFromIEnumerable( IEnumerable ien )
- {
- DataTable dt = new DataTable();
- foreach ( object obj in ien )
- {
- Type t = obj.GetType();
- PropertyInfo[] pis = t.GetProperties();
- if ( dt.Columns.Count == 0 )
- {
- foreach ( PropertyInfo pi in pis )
- {
- dt.Columns.Add( pi.Name, pi.PropertyType );
- }
- }
- DataRow dr = dt.NewRow();
- foreach ( PropertyInfo pi in pis )
- {
- object value = pi.GetValue( obj, null );
- dr[ pi.Name ] = value;
- }
- dt.Rows.Add( dr );
- }
- return dt;
- }
- var query = SqlHelper.GetFilteredObjective();
- var bs = new BindingSource();
- bs.DataSource = Utils.DataTableFromIEnumerable( query );
- dgvObjectives.DataSource = bs;
Add Comment
Please, Sign In to add comment