Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 15th, 2007, 03:03 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default If Somebody is using Forums TBH VB read this

weird...

I don't know about you but I can't see posts after first page (with cacheEnabled)!
This only happen in VB.

One of the thread functions in Post Class is:

Code:
            Dim posts As List(Of Post) = Nothing
            Dim key As String = "Forums_Thread_" & threadPostID.ToString()

            If BaseForum.Settings.EnableCaching AndAlso Not IsNothing(BizObject.Cache(key)) Then
                posts = CType(BizObject.Cache(key), List(Of Post))
            Else
                Dim recordset As List(Of PostDetails) = SiteProvider.Forums.GetThreadByID(threadPostID)
                posts = GetPostListFromPostDetailsList(recordset)
                BaseForum.CacheData(key, posts)
            End If

            Dim count As Integer = maximumRows
            If posts.Count < startRowIndex + maximumRows Then count = posts.Count - startRowIndex
            Dim array As Post()
            ReDim array(count - 1)
            posts.CopyTo(startRowIndex, array, 0, count) ' was count
            posts.Clear()
            posts.AddRange(array)
            Return posts
After some time trying understand, the line "Post.Clear" update the cache! If the post.count was "15" after the first the count will be updated to the MaximumRows...

I changed to:
Code:
            Dim count As Integer = maximumRows
            If posts.Count < startRowIndex + maximumRows Then count = posts.Count - startRowIndex
            'Dim array As Post()
            'ReDim array(count - 1)
            'posts.CopyTo(startRowIndex, array, 0, count) ' was count
            'posts.Clear()
            'posts.AddRange(array)
            Return posts.GetRange(startRowIndex, count)
And it worked...
Beside I don't understand why marco used posts.CopyTo when he could simply used posts.GetRange

Doesn't C# have list.rangeTo(startIndex, count) ?

I hope it helped someone

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TBH Starter Kit forum on ASP.NET Forums rocco50 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 March 5th, 2007 01:53 PM
Buiding Forums in ASP.NET and VB.NET saif44 ASP.NET 1.0 and 1.1 Professional 3 November 2nd, 2006 01:52 PM
Suggestion - Create Separate Forums for VB and C# RobC BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 September 8th, 2006 03:12 PM
Opening word document read only in VB StevenVints VB How-To 1 May 3rd, 2006 09:52 AM
Why use VB.Net to read Access? AmyEL VB.NET 2002/2003 Basics 3 February 24th, 2005 12:12 PM



All times are GMT -4. The time now is 09:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.