dt.Rows.insertAt(……)
括号里的参数要怎么写啊 大侠 我刚学
2 个解决方案
#1
//DataTable dt
DataRow dr = dt.NewRow();
dt.Rows.InsertAt(dr, 0);
#2
我遇到的问题,刚解决
Dim indexNumCount As Integer
indexNumCount = gdv_detail_list.CurrentRow.Index + 1
Dim dt As DataTable = CType(Me.gdv_detail_list.DataSource, DataTable)
Dim dr As DataRow = dt.NewRow()
'Set Value
dr(0) = ""
dr(1) = ""
'Add Row To DataTable
'dt.Rows.Add(dr)
dt.Rows.InsertAt(dr, indexNumCount)
'重新设置DataGridView的数据源
'Clear History DataSource
Me.gdv_detail_list.DataSource = Nothing
'Set New Data Source
Me.gdv_detail_list.DataSource = dt
Dim indexNumCount As Integer
indexNumCount = gdv_detail_list.CurrentRow.Index + 1
Dim dt As DataTable = CType(Me.gdv_detail_list.DataSource, DataTable)
Dim dr As DataRow = dt.NewRow()
'Set Value
dr(0) = ""
dr(1) = ""
'Add Row To DataTable
'dt.Rows.Add(dr)
dt.Rows.InsertAt(dr, indexNumCount)
'重新设置DataGridView的数据源
'Clear History DataSource
Me.gdv_detail_list.DataSource = Nothing
'Set New Data Source
Me.gdv_detail_list.DataSource = dt
#1
//DataTable dt
DataRow dr = dt.NewRow();
dt.Rows.InsertAt(dr, 0);
#2
我遇到的问题,刚解决
Dim indexNumCount As Integer
indexNumCount = gdv_detail_list.CurrentRow.Index + 1
Dim dt As DataTable = CType(Me.gdv_detail_list.DataSource, DataTable)
Dim dr As DataRow = dt.NewRow()
'Set Value
dr(0) = ""
dr(1) = ""
'Add Row To DataTable
'dt.Rows.Add(dr)
dt.Rows.InsertAt(dr, indexNumCount)
'重新设置DataGridView的数据源
'Clear History DataSource
Me.gdv_detail_list.DataSource = Nothing
'Set New Data Source
Me.gdv_detail_list.DataSource = dt
Dim indexNumCount As Integer
indexNumCount = gdv_detail_list.CurrentRow.Index + 1
Dim dt As DataTable = CType(Me.gdv_detail_list.DataSource, DataTable)
Dim dr As DataRow = dt.NewRow()
'Set Value
dr(0) = ""
dr(1) = ""
'Add Row To DataTable
'dt.Rows.Add(dr)
dt.Rows.InsertAt(dr, indexNumCount)
'重新设置DataGridView的数据源
'Clear History DataSource
Me.gdv_detail_list.DataSource = Nothing
'Set New Data Source
Me.gdv_detail_list.DataSource = dt