Results 1 to 12 of 12

Thread: Formatting is slow in DataGridView than MSFlexgrid

Threaded View

  1. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Formatting is slow in DataGridView than MSFlexgrid

    For i = 0 To DtdgDataSource.RowCount - 2
    For j = 8 To 13
    DtdgDataSource.Rows(i).Cells(j).Style.Font = New Font(DtdgDataSource.Font, FontStyle.Bold)
    Next
    Next
    The above code will create a new FONT object for each row, which will be slow.

    Not sure if this would make a difference, but just give it a try:

    Code:
               Dim myFont as New Font(DtdgDataSource.Font, FontStyle.Bold)
               For i = 0 To DtdgDataSource.RowCount - 2
                    For j = 8 To 13
                        DtdgDataSource.Rows(i).Cells(j).Style.Font = myFont
                    Next
                Next
    Last edited by Pradeep1210; May 20th, 2013 at 04:12 AM.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

Tags for this Thread

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