How can I add a new row to an UltraWinGrid?
you need to declare datatable and datarow in order to create new rows in ultragrid. upto my knowledge there are no other ways to add rows in ultragrid below is the sample code.
If Not dt.Columns.Count = 0 Then
For i = 0 To ucmb.DisplayLayout.Bands(0).Columns.Count - 1
dr = dt.NewRow()
Next
Else
For i = 0 To ucmb.DisplayLayout.Bands(0).Columns.Count - 1
dr = dt.NewRow()
Dim colname As String = ucmb.DisplayLayout.Bands(0).Columns(i).Header.Caption.ToString()
dt.Columns.Add(colname, GetType(String))
Next
End If
dt.Rows.Add(dr)
ucmb.DataSource = dt
End Sub
you can call the above function like this
Dim ds As DataSet
Dim dt As New DataTable
For i = 0 To 6
addrow_Ultragrid(dt, dr, UltraGrid1)
Next
the above code will create six rows into ultragrid declare dt and dr globally.
No comments:
Post a Comment