Link to home
Start Free TrialLog in
Avatar of codefinger
codefingerFlag for United States of America

asked on

How to keep binding source current with datagrid row clicked...

In the attached code, bs is a bindingsource for a datagrid.  
bs.current always returns the first row in the grid regardless of which row in the grid has been clicked on.
How do I keep the bindingsource current with the visually sekected row on the datagrid?

Thanks in advance.
Public Function RemovePages(ByRef lex As LastException) As Boolean

        Dim fc As HPFFAFormClass = Nothing
        Dim fp As PageFileClass = Nothing
        Dim retval As Boolean = True

        Try
            fc = bs.Current
            For Each fp In frm.ListBoxPageFiles.SelectedItems
                fc.Pages.Remove(fp)
            Next
            frm.ListBoxPageFiles.DataSource = Nothing
            frm.ListBoxPageFiles.DataSource = fc.Pages
            frm.ListBoxPageFiles.DisplayMember = "PageName"
            frm.ListBoxPageFiles.ValueMember = "Pageno"

        Catch ex As Exception
            retval = False
            lex.Message = ex.Message
            If Not ex.InnerException Is Nothing Then
                lex.Detail = ex.InnerException.Message
            End If
            lex.Code = "System Exception"
            lex.Source = "FormManagerCtrl - RemovePages"

        End Try
        
        Return retval


    End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of codefinger
codefinger
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial