Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

DatagidView Formatting Lost on Sort

Options
  • 12-01-2009 5: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 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 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