2019年1月10日 星期四

VB 陣列

二維陣列

Dim arrColumn(,) As String = {{"DOCNO", "合約編號"}, {"BU_NAME", "事業群"}, {"COMPANY_CNAME", "公司別"}}


For i As Integer = 0 To arrColumn.GetLength(0) - 1
       xxx.Text += arrColumn(i, 0) & "<br>"
Next



取值方法:(其他範例)
Module Example Public Sub Main() Dim numbers As Integer(,) = GetNumbersMultidim() ShowNumbersMultidim(numbers) End Sub Private Function GetNumbersMultidim() As Integer(,) Dim numbers As Integer(,) = {{1, 2}, {3, 4}, {5, 6}} Return numbers End Function Private Sub ShowNumbersMultidim(numbers As Integer(,)) For index0 = 0 To numbers.GetUpperBound(0) For index1 = 0 To numbers.GetUpperBound(1) Console.Write($"{numbers(index0, index1)} ") Next Console.WriteLine() Next End Sub End Module

沒有留言:

張貼留言