troubleshooting Question

Visual Studio (VB).net FOR Statement

Avatar of comsult
comsult asked on
Visual Basic.NET
10 Comments2 Solutions367 ViewsLast Modified:
In a Visual Studio (Visual Basic) 2005 app, we "pull" data from a Web Service, display it in a datagrid and then insert it into a SQLCE DB.

We have several FOR statements which iterate properly, we take each value from the FORs and pass them to the DB via the datagrid.

The following FOR however does get the values (maximum of three per service) but always ONLY gives us the last one. We assume that means the other two are being over-written and it isn't "stopping" until the last possible value is obtained.

The FOR is as follows (ShipToLocation is a String Collection, .Item is the DataRow, IntShipLoc1 is the SQLCE):

For Each iss As InternationalShippingServiceOptionsType In _ item.ShippingDetails.InternationalShippingServiceOption
If Not iss.ShipToLocation Is Nothing Then
.Item("IntShipLoc1") = String.Join(", ", iss.ShipToLocation.ToArray())
Else
.Item("IntShipLoc1") = "False"
End If
'Next

The FOR statements that do work have a count as follows (Minus 1 to Minus 3 across three FORs :

For int1 = 0 To item.ShippingDetails.InternationalShippingServiceOption.Count - 1

We have tried "tying" the non-working FOR into the count FOR but that doesn't help either.

Any help would be hugely appreciated, we have spent days going round and round in circles !

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros