StrataFrame Forum

DevExpress Sample - Connect Grid with Textboxes

http://forum.strataframe.net/Topic1626.aspx

By Ricardo Quartier - 6/21/2006

Hi bros, I've been watchin that DevExpressSample video, and i have a question. Is that a way to connect the grid with the textboxes? This way the aplication can be improved, click the register on the grid, then the textboxes will move to the same register.

Is that a way to make this work?

By StrataFrame Team - 6/22/2006

Yes, you can bind the business object to a grid through a BusinessBindingSource and then bind the business object to the textboxes.  The grid should have an event that you can handle such as RowSelected, SelectedRowIndexChanged, AfterRowSelect, or something to that effect.  In a handler for that method, Navigate() the business object to the row and the textboxes bound to the business object will reflect the selected record in the business object.
By Ricardo Quartier - 6/22/2006

I mean, Enhanced List
By Ricardo Quartier - 6/22/2006

Is it still the same way to the List? BigGrin
By StrataFrame Team - 6/22/2006

Yes, if you're using the ListView, you'll want to attach to the SelectedIndexChanged event.

If you're using the EnhancedList, the event is SelectedRowChanged.

By Ricardo Quartier - 7/7/2006

Yo, Ben, shold this work?

Private Sub EnhancedList1_SelectedRowChanged() Handles EnhancedList1.SelectedRowChanged

Me.BoCadEmpresa1.Navigate(MicroFour.StrataFrame.Business.BusinessNavigationDirection.Absolute)

End Sub

 

w00t cause it's not working...

By StrataFrame Team - 7/8/2006

Close, Ricardo, but when you navigate Absolute, you need to use the other overload that allows you to specify the absolute index.  Like this:

Private Sub EnhancedList1_SelectedRowChanged() Handles EnhancedList1.SelectedRowChanged
    '-- Establish locals
    Dim loRows As Integer()

    '-- Get the selected rows
    loRows = CType(Me.EnhancedList1.MainView, DevExpress.XtraGrid.Views.Grid.GridView).GetSelectedRows()

    '-- Determine whether there is a row selected
    If loRows.Length > 0 Then
        '-- Navigate to the row within the business object
        Me.BoCadEmpresa1.Navigate(MicroFour.StrataFrame.Business.BusinessNavigationDirection.Absolute, loRows(0))
    End If

End Sub

By Ricardo Quartier - 7/9/2006

Yo, Ben thanks, I'll try here.... Smile