Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

DatagidView Formatting Lost on Sort

  • 12-01-2009 05:33PM
    #1
    Closed Accounts Posts: 2,268 ✭✭✭


    VB.net
    I have a datagrid view to which formatting is applied at runtime. When I click the column header the grid sorts as expected. However I can't reapply this formatting.

    I am tring to reapply the formatting from the click event.

    MM


Comments

  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    If you add the formatting onItem_DataBound I think it should be ok..

    Where are you applying the formatting in the first place?


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    I am applying it on the initial load of the form. The datagrid is populated from a stored procedure.
            LoadGrid()
    
            AllFormatting()
    

    That's the pattern.


  • Registered Users, Registered Users 2 Posts: 610 ✭✭✭nialo


    You have to recall your AllFormating method within your Sorted method.


  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    OK but I am just using the standard sort (by clicking on the column header) I call my fromat method from repaint
        Private Sub PAINT(ByVal sender As System.Object, _ 
     ByVal e As System.Windows.Forms.PaintEventArgs)  _ 
     HandlesMygrid.Paint
        
        AllFormatting()
    
        End Sub
    

    The formatting is reapplied but shows a screen flicker as it happens.


Advertisement