Know the reason

I check the control does not get into the following codes.
        For Each item In ds.OrderBy(Function(x) x.TransactionDate)
            SetColumnValue(DataSheet, rowIndex, 1, item.AccountCode,
                                                    String.Format("""{0}""", item.Description),
                                                    String.Format("""{0}""", item.TransactionRef),
                                                    Math.Abs(Math.Round(item.Amount, 2)),
            rowIndex += 1

Open in new window

how to check the value like


to find out the reason.
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
since it's related to debugging, hence you could have at least 2 approaches:

1. use the breakpoint, so that when you code is running and hit the condition, it will break and stopped, and hence you can verify the current state of the values or objects when needed.

Using Breakpoints

2. use the watches, this would be useful to evaluate the values or the object's changes in a certain state of your program.

Watch and QuickWatch Windows
HuaMin ChenProblem resolverAuthor Commented:
I put breakpoint on "For ..." line, but it does not get into the loop, even if I've pressed "F11"

Any way to check the value of "item"?
Ryan ChongCommented:
>>but it does not get into the loop
once it's stopped, try to add the variables/ objects into the "watch", so that you can examine its values.

for example, either add: x.TransactionDate or x into the watch for debugging....
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Ryan ChongCommented:
>>Any way to check the value of "item"?
similarly, add "item" into the "watch"
HuaMin ChenProblem resolverAuthor Commented:
Any advice to the following?

Ryan ChongCommented:
what about adding:

ds.OrderBy(Function(x) x.TransactionDate)



into the watch ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ste5anSenior DeveloperCommented:
What type is ds?

Cause this works:

Module Module1

    Class ItemClass
        Public Property TransactionDate As Date
        Public Property AccountCode As String
        Public Overrides Function ToString() As String
            Return Me.AccountCode + " - " & Me.TransactionDate
        End Function
    End Class

    Sub Main()

        Dim ds As List(Of ItemClass) = New List(Of ItemClass)
        ds.Add(New ItemClass() With {.AccountCode = "1", .TransactionDate = Date.Today.AddDays(-1)})
        ds.Add(New ItemClass() With {.AccountCode = "2", .TransactionDate = Date.Today})
        ds.Add(New ItemClass() With {.AccountCode = "3", .TransactionDate = Date.Today.AddDays(-2)})

        Dim rowIndex As Long = 0

        For Each item In ds.OrderBy(Function(x) x.TransactionDate)
            rowIndex += 1


    End Sub

End Module

Open in new window

HuaMin ChenProblem resolverAuthor Commented:
Many thanks all.

I get this
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.