vb.net二维数组添加 vb如何定义二维数组

如何在VB.NET中将二维数组赋值给listview控件啊,谢谢

将二位数组转成DataTable,网上找的不知道成不成

东方网站建设公司创新互联,东方网站设计制作,有大型网站制作公司丰富经验。已为东方上1000家提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的东方做网站的公司定做!

public static DataTable ConvertToDataTable(string[,] arr)

{

DataTable dataSouce = new DataTable();

for (int i = 0; i arr.GetLength(1); i++)

{

DataColumn newColumn = new DataColumn(i.ToString(), arr[0, 0].GetType());

dataSouce.Columns.Add(newColumn);

}

for (int i = 0; i arr.GetLength(0); i++)

{

DataRow newRow = dataSouce.NewRow();

for (int j = 0; j arr.GetLength(1); j++)

{

newRow[j.ToString()] = arr[i, j];

}

dataSouce.Rows.Add(newRow);

}

return dataSouce;

}

VB.net中如何将 二维数组 插入 excel表格

这个比较简单

假如二维数组是str(row,col)

假设Workbook是Excel的工作簿对象

Workbook.worksheets(1).range("A2").Resize(row+1, col+1).Value = str

其中关键的是Excel的Resize方法能快速的插入二维数组

vb.net把二维数组的值插入数据库中

格式就错了,你这city()程序会把它当成字SQL语句里的函数的,一般sql里面带括号都是sql里自带的函数,这个sql里当然是没有的了

应该是这样写的:

Dim cmd2 As New OleDbCommand("insert into 20072786 values(" city(i,0) "," city(i,1) "," city(i,2) "," city(i,3) ")" , db1)

VB.NET 用二维数组的方式动态加控制 例如在窗体上动态添加GroupBox,然后再在GroupBox里动态添加控件

下面这段代码完成,在窗体上用语句添加2个 GroupBox控件,且在每个GroupBox控件中添加4个 RadioButton 控件。

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim i As Integer

'添加2个GroupBox

Dim MyGroupBox(2) As GroupBox

For i = 1 To 2

'将一个GroupBox控件加入到Form上

MyGroupBox(i) = New GroupBox

Me.Controls.Add(MyGroupBox(i))

'设置该GroupBox控件的属性

MyGroupBox(i).Height = 240

MyGroupBox(i).Width = 600

MyGroupBox(i).Top = (i - 1) * (240 + 20) + 20

MyGroupBox(i).Left = 20

'修改新加入控件的Text值

MyGroupBox(i).Text = "GroupBox" CStr(i)

Next

'每个GroupBox中添加4个单选按钮

Dim MyRadioButton1(4) As RadioButton

Dim MyRadioButton2(4) As RadioButton

For i = 1 To 4

MyRadioButton1(i) = New RadioButton

Me.Controls.Add(MyRadioButton1(i))

MyRadioButton1(i).Parent = MyGroupBox(1)

'设置该GroupBox控件的属性

MyRadioButton1(i).Height = 20

MyRadioButton1(i).Width = 120

MyRadioButton1(i).Top = (i - 1) * (20 + 20) + 40

MyRadioButton1(i).Left = 20

'修改新加入控件的Text值

MyRadioButton1(i).Text = "RadioButton1_" CStr(i)

Next

For i = 1 To 4

MyRadioButton2(i) = New RadioButton

Me.Controls.Add(MyRadioButton2(i))

MyRadioButton2(i).Parent = MyGroupBox(2)

'设置该GroupBox控件的属性

MyRadioButton2(i).Height = 20

MyRadioButton2(i).Width = 120

MyRadioButton2(i).Top = (i - 1) * (20 + 20) + 40

MyRadioButton2(i).Left = 20

'修改新加入控件的Text值

MyRadioButton2(i).Text = "RadioButton2_" CStr(i)

Next

End Sub


网页题目:vb.net二维数组添加 vb如何定义二维数组
URL标题:http://cdiso.cn/article/docojgh.html

其他资讯