Results 1 to 11 of 11

Thread: mshflexgrid1 row to mshflexgrid2 row or listview row

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    36

    mshflexgrid1 row to mshflexgrid2 row or listview row

    first i will populate mshflexgrid1 , what im trying to do is when i click a row in mshflexgrid1 , the same row will be highlighed in flexgrid2 and listview . thx

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    Use the RowSel property of the flexgrid.
    Code:
    Option Explicit
    
    Private Sub MSFlexGrid1_SelChange()
        If MSFlexGrid1.RowSel > 0 Then
            'Select your corresponding row in your other control using the .RowSel value
        End If
    End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    36

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    when will the MSFlexGrid1_SelChange occur? do u have sample program,? thx
    Last edited by mamba; Jan 6th, 2008 at 05:30 AM.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    It will fire when something that has been selected changes.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    I posted "sample code" for you. When you make a selection the "MSFlexGrid1_SelChange" event will fire which is where you can write your code to programmatically select your corresponding row in your listview or ???
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    36

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    what is did was..
    Code:
    Private Sub MSHFlexGrid1_Click()
        
        MSHFlexGrid2.RowSel = MSHFlexGrid1.RowSel
    
    End Sub
    but the flexgrid2 has a highlighting problem,highlighting multiple rows and never really highligting the selected row in flexgrid1

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    Set the row/col positions on the second grid first before changing the selection.
    Code:
    MSFlexGrid2.Col = MSFlexGrid1.Col
    MSFlexGrid2.Row = MSFlexGrid1.Row
    MSFlexGrid2.RowSel = MSFlexGrid1.RowSel
    MSFlexGrid2.ColSel = MSFlexGrid1.ColSel
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    36

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    thx its works but i have another prob. when i scroll down flexgrid1 then select. the flexgrid2 doesn't scroll down/follow the item i selected

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    Of course not, you have to code everything in programming. So tell the second grid to scroll down upon the first grids scroll event.
    Code:
    Private Sub MSFlexGrid1_Scroll()
        MSFlexGrid2.TopRow = MSFlexGrid1.TopRow
    End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Member
    Join Date
    Sep 2007
    Posts
    36

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    thx. is there a way to highlight the full row, because the first column is not highlighted

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: mshflexgrid1 row to mshflexgrid2 row or listview row

    Code:
    Option Explicit
    
    Private Sub MSFlexGrid1_Click()
        'Select the starting column
        MSFlexGrid1.Col = 0
        'Select the end column
        MSFlexGrid1.ColSel = MSFlexGrid1.Cols - 1
        'Select the second grids row
        MSFlexGrid2.Col = MSFlexGrid1.Col
        MSFlexGrid2.Row = MSFlexGrid1.Row
        MSFlexGrid2.RowSel = MSFlexGrid1.RowSel
        MSFlexGrid2.ColSel = MSFlexGrid1.ColSel
    End Sub
    
    Private Sub MSFlexGrid1_Scroll()
        MSFlexGrid2.TopRow = MSFlexGrid1.TopRow
    End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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