asp一个定义,转换成asp.net 如何定值。UP也给分

lyj670 2007-09-13 10:55:15
dim nbd
nbd = Array(0)


这个转换成vb.net该如何定义,如何赋值?
...全文
109 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ny-6000 2007-09-14
  • 打赏
  • 举报
回复
应该是

dim nbd as new array(0)

yoofaithy 2007-09-14
  • 打赏
  • 举报
回复
dim nbd(10) as Array
liujiayu10 2007-09-14
  • 打赏
  • 举报
回复
Dim nbd as Array()
lazyboy1982 2007-09-14
  • 打赏
  • 举报
回复
Dim strArray() As String = {"", "", ""}
strArray =值 《-----取值
1.Text = strArray(0)
2.Text = strArray(1)
3.Text = strArray(2) 《-----赋值
lyj670 2007-09-13
  • 打赏
  • 举报
回复
出错提示:数组界限不能出现在类型说明符中。
如果是Dim nbd as Array()
不出错,但不知对错,及如何赋值
rtsp 2007-09-13
  • 打赏
  • 举报
回复
好像一样吧,vb.net不熟

Dim nbd as Array(0)
bvtc_liguoyuan 2007-09-13
  • 打赏
  • 举报
回复
Dim nbd as Array()
rtsp 2007-09-13
  • 打赏
  • 举报
回复
Goolge或msdn都可以查得到吧。。。

Public Class SamplesArray2

Public Shared Sub Main()

' Creates and initializes a new three-dimensional Array of
' type Int32.
Dim myArr As Array = Array.CreateInstance(GetType(Int32), 2, 3, 4)
Dim i As Integer
For i = myArr.GetLowerBound(0) To myArr.GetUpperBound(0)
Dim j As Integer
For j = myArr.GetLowerBound(1) To myArr.GetUpperBound(1)
Dim k As Integer
For k = myArr.GetLowerBound(2) To myArr.GetUpperBound(2)
myArr.SetValue(i * 100 + j * 10 + k, i, j, k)
Next k
Next j
Next i ' Displays the properties of the Array.
Console.WriteLine("The Array has {0} dimension(s) and a " _
+ "total of {1} elements.", myArr.Rank, myArr.Length)
Console.WriteLine(ControlChars.Tab + "Length" + ControlChars.Tab _
+ "Lower" + ControlChars.Tab + "Upper")
For i = 0 To myArr.Rank - 1
Console.Write("{0}:" + ControlChars.Tab + "{1}", i, _
myArr.GetLength(i))
Console.WriteLine(ControlChars.Tab + "{0}" + ControlChars.Tab _
+ "{1}", myArr.GetLowerBound(i), myArr.GetUpperBound(i))
Next i

' Displays the contents of the Array.
Console.WriteLine("The Array contains the following values:")
PrintValues(myArr)
End Sub

Public Shared Sub PrintValues(myArr As Array)
Dim myEnumerator As System.Collections.IEnumerator = _
myArr.GetEnumerator()
Dim i As Integer = 0
Dim cols As Integer = myArr.GetLength(myArr.Rank - 1)
While myEnumerator.MoveNext()
If i < cols Then
i += 1
Else
Console.WriteLine()
i = 1
End If
Console.Write(ControlChars.Tab + "{0}", myEnumerator.Current)
End While
Console.WriteLine()
End Sub
End Class

' This code produces the following output.
'
' The Array has 3 dimension(s) and a total of 24 elements.
' Length Lower Upper
' 0: 2 0 1
' 1: 3 0 2
' 2: 4 0 3
' The Array contains the following values:
' 0 1 2 3
' 10 11 12 13
' 20 21 22 23
' 100 101 102 103
' 110 111 112 113
' 120 121 122 123

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧