troubleshooting Question

data table questions

Avatar of Robb Hill
Robb HillFlag for United States of America asked on
.NET ProgrammingEditors IDEs
2 Comments1 Solution185 ViewsLast Modified:
I have a array of datarows that sometimes has length and sometimes has 0 lenght.  Do you see anything in this code segment that would make this aarray get set to 0.  Whats strange is it works sometimes and sometimes it doesnt.

Private Sub Focus(ByVal field As String, ByVal criteria As String)
                Dim expression As String
                Dim criterias As String()
                If InStr(field, "Date") Then
                    criterias = criteria.Split(",")
                    expression = field & " >= #" & criterias(0) & "#" & " AND " & field & " <= #" & criterias(1) & "#"
                    expression = field & " IN (" & criteria & ")"
                End If
                Dim adrEdit() As DataRow = dt.Select(expression)
                If UBound(adrEdit, 1) > -1 Then
                    Dim cdt As New DataTable
                    cdt = dt.Clone
                    For Each dr As DataRow In adrEdit
                        Dim cdr As DataRow
                        cdr = cdt.NewRow
                        For i As Int16 = 0 To dt.Columns.Count - 1
                            cdr(i) = dr(i)
                    dt = cdt.Copy
                End If
            End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 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 1 Answer and 2 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