C
cloud
I want to move the rows in datatable up and down....
Here is my code:
Dim dt As DataTable
dt = New DataTable("Example")
Dim dr As DataRow
Dim Name As DataColumn = New DataColumn("names")
'setting the datatype for the column
dt.Columns.Add(Name)
For j = 1 To 5
dr = dt.NewRow()
dr.Item(0) = j
dt.Rows.Add(dr)
next
dim ds as new Dataset()
ds = New DataSet()
ds.Tables.Add(dt)
DataGridView2.DataSource = ds.Tables(0)
the output is as below:
1
2
3
4
5
On button click i have to move the selected row in datagridview up or
down.
How to get the selectedrow in datatable ??
Thank you
Here is my code:
Dim dt As DataTable
dt = New DataTable("Example")
Dim dr As DataRow
Dim Name As DataColumn = New DataColumn("names")
'setting the datatype for the column
dt.Columns.Add(Name)
For j = 1 To 5
dr = dt.NewRow()
dr.Item(0) = j
dt.Rows.Add(dr)
next
dim ds as new Dataset()
ds = New DataSet()
ds.Tables.Add(dt)
DataGridView2.DataSource = ds.Tables(0)
the output is as below:
1
2
3
4
5
On button click i have to move the selected row in datagridview up or
down.
How to get the selectedrow in datatable ??
Thank you