vb.net文本框数组 vb语言数组
vb.net用文本框输入数组的所有元素,数值之间用逗号分隔,统计数组中正数的个数,并显示最大值的元素下标
Dim str As String = "", temp, n As Integer
创新互联公司从2013年开始,是专业互联网技术服务公司,拥有项目网站设计、成都网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元景洪做网站,已为上家服务,为景洪各地企业和个人服务,联系电话:13518219792
Dim str1 As String = "12,45,2,9,41,31,66,83,2,1,-9,-91,-21"
Dim a() As String = Split(str1, ",")
For i = 1 To UBound(a) Step 1
a(i) = Val(a(i))
Next
temp = 0
n = 0
For i = 1 To UBound(a)
If a(i) temp Then
temp = a(i)
End If
If a(i) 0 Then
n = n + 1
End If
Next
str = str "正数的个数为 " n
str = str "最大元素的下标为 "
For i = 1 To UBound(a)
If a(i) = temp Then
str = str i " "
End If
Next
TextBox6.Text = str
vb中如何添加文本框数组
(1)先在窗口上放一个text1,选中它,击右键,选“复制”
(2)再在窗口上单击右键,选“粘贴”,即形成了一个文本框数组
(3)重复第二步,多粘贴几次,即可产生具有多个元素的文本框数组
vb.net数组
Dim str As String = "", temp, n As Integer
Dim str1 As String = "12,45,2,9,41,31,66,83,2,1,-9,-91,-21"
Dim a() As String = Split(str1, ",")
For i = 1 To UBound(a) Step 1
a(i) = Val(a(i))
Next
temp = 0
n = 0
For i = 1 To UBound(a)
If a(i) temp Then
temp = a(i)
End If
If a(i) 0 Then
n = n + 1
End If
Next
str = str "正数的个数为 " n
str = str "最大元素的下标为 "
For i = 1 To UBound(a)
If a(i) = temp Then
str = str i " "
End If
Next
TextBox6.Text = str
当前标题:vb.net文本框数组 vb语言数组
当前路径:http://myzitong.com/article/hggpes.html