Know the reason

Hi,
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),
                                                    item.AccountingPeriod,
                                                    item.TransactionDate,
                                                    Math.Abs(Math.Round(item.Amount, 2)),
                                                    item.DebitCredit,
                                                    item.Department,
                                                    item.BrandCode,
                                                    "",
                                                    item.ShopCode,
                                                    item.Stakeholder,
                                                    item.ProductTypeCodeText(2),
                                                    "END")
            rowIndex += 1
        Next

Open in new window

           
how to check the value like

TransactionDate

to find out the reason.
LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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 ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
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
https://msdn.microsoft.com/en-us/library/5557y8b4.aspx

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
https://msdn.microsoft.com/en-us/library/0taedcee.aspx
HuaMin ChenProblem resolverAuthor Commented:
Thanks.
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 ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>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....
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>Any way to check the value of "item"?
similarly, add "item" into the "watch"
HuaMin ChenProblem resolverAuthor Commented:
Any advice to the following?

20
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
what about adding:

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

or:

ds

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)
            Console.WriteLine(item.ToString())
            rowIndex += 1
        Next

        Console.WriteLine("Done.")
        Console.ReadLine()

    End Sub

End Module

Open in new window

HuaMin ChenProblem resolverAuthor Commented:
Many thanks all.

I get this
20b
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.