I am using a CommandBarDropDownList to trigger a refresh of the bindingsource for a GridView. The linq query takes a little while to execute, so the UI gets frozen, which is ok. Prior to executing the query, I would like the dropdownlist to fully collapse. I attempt to use application.doevents, but it still will not collapse until the query runs. See snippet below.
Thanks,
Neal
EDIT: Tried with regular DropDownList (not in commandbar) and same behavior. Tried with winforms combobox and the control successfully collapses.
Thanks,
Neal
EDIT: Tried with regular DropDownList (not in commandbar) and same behavior. Tried with winforms combobox and the control successfully collapses.
Private Sub CommandBarDropDownList1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CommandBarDropDownList1.TextChanged UpdateGrid() End SubPrivate Sub UpdateGrid() Application.DoEvents() Me.Cursor = Cursors.WaitCursor Dim db As New DAL_DataContext db.Log = Console.Out Dim qryRep = (From item In db.RepSaleDetails Where item.RepSaleHeader.Date.Value.Year = CommandBarDropDownList1.Text Select _ Descr = item.RepSaleHeader.Rep.LastName, _ Amount = CInt(item.Qty * item.Price), _ Month = item.RepSaleHeader.Date.Value.Month) Dim qryCust = From item In db.CustSaleDetails Where item.CustSaleHeader.Date.Value.Year = CommandBarDropDownList1.Text _ And item.CustSaleHeader.RefNo >= 3000 Select _ Descr = "Ann", _ Amount = CInt(item.Qty * item.Price), _ Month = item.CustSaleHeader.Date.Value.Month Dim qryInternet = From item In db.CustSaleDetails Where item.CustSaleHeader.Date.Value.Year = CommandBarDropDownList1.Text _ And item.CustSaleHeader.RefNo < 3000 Select _ Descr = "Ann Internet", _ Amount = CInt(item.Qty * item.Price), _ Month = item.CustSaleHeader.Date.Value.Month Dim qryAll = qryRep.Concat(qryCust).Concat(qryInternet) Dim MyTable = qryAll.GroupBy(Function(i) i.Descr).Select(Function(g) New TrendAnnual With _ {.Descr = g.Key, _ .Tot = g.Sum(Function(c) c.Amount), _ .Jan = g.Where(Function(c) c.Month = 1).Sum(Function(d) d.Amount), _ .Feb = g.Where(Function(c) c.Month = 2).Sum(Function(d) d.Amount), _ .Mar = g.Where(Function(c) c.Month = 3).Sum(Function(d) d.Amount), _ .Apr = g.Where(Function(c) c.Month = 4).Sum(Function(d) d.Amount), _ .May = g.Where(Function(c) c.Month = 5).Sum(Function(d) d.Amount), _ .Jun = g.Where(Function(c) c.Month = 6).Sum(Function(d) d.Amount), _ .Jul = g.Where(Function(c) c.Month = 7).Sum(Function(d) d.Amount), _ .Aug = g.Where(Function(c) c.Month = 8).Sum(Function(d) d.Amount), _ .Sep = g.Where(Function(c) c.Month = 9).Sum(Function(d) d.Amount), _ .Oct = g.Where(Function(c) c.Month = 10).Sum(Function(d) d.Amount), _ .Nov = g.Where(Function(c) c.Month = 11).Sum(Function(d) d.Amount), _ .Dec = g.Where(Function(c) c.Month = 12).Sum(Function(d) d.Amount)}) GridBindingSource.DataSource = MyTable.OrderBy(Function(i) i.Descr) db.Dispose() Me.Cursor = Cursors.DefaultEnd Sub