Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Visual Basic 2010 and .NET 4
This is the forum to discuss the Wrox book Professional Visual Basic 2010 and .NET 4 by Bill Sheldon, Billy Hollis, Kent Sharkey, Gaston Hillar, Rob Windsor, Jonathan Marbutt; ISBN: 9780470502242
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Basic 2010 and .NET 4 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 4th, 2015, 10:45 PM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter Two Sorting

I downloaded the sorting code in chapter 2, and it worked fine. I then added the Sort module, Person file and part of the Form code to my project. The project ran just like your code, except mine would not calculate the ages, and the resulting sort left the array just like it was. I found out that if I substituted a typed in date like this #7/1/2015# for my variable date, it would then calculate the ages. Is there some way to make your Sort code use dates and other information residing in variables? Here's the code I used.

Code:
' Get the last Id number in RLM42HD
                Dim LastRow As Integer = 0
                Dim LastId = From lId In db.RLM42HDs
                             Select lId.Id, lId.Date, lId.OrderNumber

                For Each lId In LastId
                    LastRow += 1
                Next

                Dim myPeople(LastRow - 1) As Person

                For Each lId In LastId
                    curId = lId.Id
                    curDate = lId.Date
                    myPeople(lId.Id - 1) = New Person(curId, curDate)    '-1 to accom. the array No's
                Next

                'Although this sort procedure works, it doesn't sort properly. If I replace the varitable curDate with an actual date, it works.????????????
                DoSort(myPeople, AddressOf Person.CompareAge)
BobE
Reply With Quote
  #2 (permalink)  
Old September 18th, 2015, 11:04 PM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Please disregard my post.

I made a foolishly mistake, there is nothing wrong with the downloaded sort routine in chapter two. I didn't realize that I was trying to sort dates that were all in the same year and that I had to change the sort method from years to days-of-years; then it worked fine.
BobE
Reply With Quote
  #3 (permalink)  
Old September 20th, 2015, 10:03 AM
Authorized User
Points: 146, Level: 2
Points: 146, Level: 2 Points: 146, Level: 2 Points: 146, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2015
Location: Dhaka, Bangladesh
Posts: 39
Thanks: 3
Thanked 2 Times in 2 Posts
Default

So at last it's working fine for you. LOL!
Reply With Quote
Reply


Thread Tools
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
Chapter 11 Sorting Question coronoahcoro BOOK: Beginning Visual C# 2010 0 May 4th, 2012 09:24 AM
Chapter 8 - Table View (Sorting of Arrays in Table View) teamstar BOOK: Beginning iOS 5 Application Development 1 March 15th, 2012 10:30 PM
Chapter 17 - DataGrid Sorting Example Appled BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 4 March 28th, 2005 02:13 PM
Datagrid sorting by non alphabetical sorting? LLAndy VS.NET 2002/2003 1 July 15th, 2004 01:20 AM



All times are GMT -4. The time now is 09:00 AM.


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