What I need, is one three-dimensional array that holds:

1. Column name
2. MaxLength
3. DataType

My code is close, I just can't remember the syntax for adding data to the array.

Please help,
Sheryl

'get the column information
                    Dim c As Integer = 0
                    Dim x As Integer = 0
                    Dim y As Integer = 0
                    Dim iCount As Integer = columnCount - 1
                    Dim aFields(iCount, iCount, iCount) As String
                    For Each dc As DataColumn In objDS.Tables(strTableName).Columns
                        aFields(c, x, y) = dc.ColumnName
                        aFields(c, x, y) = dc.MaxLength.ToString
                        aFields(c, x, y) = dc.DataType.ToString
                        frmDesigner.ListBox1.Items.Add(aFields(c, x, y))
                        c = c + 1
                        x = x + 1
                        y = y + 1
                    Next

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

You mean declare a class and have the those objects in a one dimensional array?

As long as I can reference each item separately, that's what I need. Thanks.

I think I figured it out. The following code puts each of the three items into the array. This may not be the best way to do it, so I'm open to suggestions.

~ Sheryl

Dim aFields(iCount, 2) As String
                    For Each dc As DataColumn In objDS.Tables(strTableName).Columns
                        aFields(c, 0) = dc.ColumnName
                        afields(c, 1) = dc.MaxLength.ToString
                        aFields(c, 2) = dc.DataType.ToString
                        c = c + 1
                  Next
Member Avatar for iamthwee

If it works it works, but I'd recommend reading up on classes as they form an integral part of code design.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.