Results 1 to 2 of 2

Thread: [2005]Binding combo boxes to datagridviews

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    [2005]Binding combo boxes to datagridviews

    Hello,

    I have 1 list box and 2 combo boxes respectively, orders, ordered, delivered.

    I have 3 datagridviews, dgvOrders, dgvOrdered, dgvdelivered.

    I also have a different binding source binded to each one.

    The customer creates orders and these new orders are placed in the orders datagridview.

    There a drop down combo in the dgv so the user can select either, Ordered, delivered.

    The customer will make the order, then click ordered, then the customer will select delivered from the orders dgv combo box and the orders will appear in the delivered dgv.

    This is difficult to explain what the users wants, Once an order has been delivered, that order number should not display in the orders, ordered comboxes. Once the order has been ordered, it should not appear in the orders and delivered combo boxes.

    But as the order can contain may rows, so orders could a mixture or orders, ordered, and delivered. so these should remain in each of the combo boxes.

    I have also used the filter properties of the binding properties to display.

    This is my code for filling the combo boxes.

    Code:
    Try
                Me.DsAddComponetAndEquipment.Orders.BeginLoadData()
                Me.TA_Orders_dsCodered1.Fill(Me.DsAddComponetAndEquipment.Orders)
                Me.DsAddComponetAndEquipment.Orders.EndLoadData()
    
                'Load and display only the orders that are new.
                Me.bsOrder.Filter = String.Format("Status = '{0}'", "New Order")
                Me.lstOrder.DataSource = Me.bsOrder
                Me.lstOrder.DisplayMember = "OrderID"
                Me.lstOrder.ValueMember = "OrderID"
    
                'This will select a newly created order, last order created will be set to the one displayed
                count = Me.lstOrder.Items.Count - 1
                If (count > 0) Then
                    Me.lstOrder.SetSelected(count, True)
                End If
    
                'Fill the pending orders combo box with orders that have only been ordered. Not to show 'Delivered'
                Me.bsPendingOrders.Filter = String.Format("Status = '{0}'", "Ordered")
                Me.cboPendingOrders.DataSource = Me.bsPendingOrders
                Me.cboPendingOrders.DisplayMember = "OrderID"
                Me.cboPendingOrders.ValueMember = "OrderID"
    
                'Fill the delivered orders combo box.
                Me.bsDeliveryOrders.Filter = String.Format("Status = '{0}'", "Delivered")
                Me.cboDeliveredOrders.DataSource = Me.bsDeliveryOrders
                Me.cboDeliveredOrders.DisplayMember = "OrderID"
                Me.cboDeliveredOrders.ValueMember = "OrderID"
    
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
    I think what is required is some very clever data binding technique. But as a novice I am looking for a more experienced way of doing it.

    Can anyone tell me is there a better way to do this,

    many thanks,

    Steve
    steve

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: [2005]Binding combo boxes to datagridviews

    Any suggestions?

    Thanks
    steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width