For saving all the rows from grid to recordset/dataset, I am using the following code in VB6 with datawidgets 3.13.
I want to acheive the same in VB.net with Ultrawingrid, but I could not find any samples.Thanks & waiting for the reply.
'ssInvoice is the name of grid'rsInvoiceItem is the name of the recordset
dim lcount as integer, i as integer strSql = "Select * from T_INVOICE_ITEM where InvoiceNo = " & Val(txtInvoiceNo.Text) & "" Set rsInvoiceItem = New ADODB.Recordset rsInvoiceItem.Open strSql, ADOConnData, adOpenDynamic, adLockOptimistic
lCount = ssInvoice.Rows ssInvoice.MoveFirst For i = 1 To lCount If Val("" & ssInvoice.Columns("SrNo").Text) <> 0 And Trim("" & ssInvoice.Columns("ItemId").Text) <> "" Then rsInvoiceItem.AddNew rsInvoiceItem!InvoiceNo = Trim("" & txtInvoiceNo.Text) rsInvoiceItem!Srno = i '"" & ssInvoice.Columns("SrNo").Text rsInvoiceItem!ItemId = "" & ssInvoice.Columns("ItemId").Text rsInvoiceItem!ItemDesc = "" & ssInvoice.Columns("ItemDesc").Text rsInvoiceItem!GroupId = "" & ssInvoice.Columns("GroupId").Value rsInvoiceItem!GroupDesc = "" & ssInvoice.Columns("GroupDesc").Text rsInvoiceItem!UnitPrice = Val("" & ssInvoice.Columns("UnitPrice").Text) rsInvoiceItem!DiscPerc = Val("" & ssInvoice.Columns("Disc%").Text) rsInvoiceItem!NetPrice = Val("" & ssInvoice.Columns("NetPrice").Text) rsInvoiceItem!SaleQty = Val("" & ssInvoice.Columns("SaleQty").Text) rsInvoiceItem!SaleValue = Val("" & ssInvoice.Columns("NetPrice").Text) * Val("" & ssInvoice.Columns("SaleQty").Text) rsInvoiceItem.Update End If ssInvoice.MoveNext Next i
The approach is not really any different; the .NET UltraGrid exposes a Rows collection, and UltraGridRow exposes a Cells collection, so you would just iterate the Rows collection, and assign the value of each cell to the corresponding field in the recordset.
Hello
thanks for the reply, however I could not acheived what I want.
In Sheridian Datawdidgets (using vb6), in the grid property of DataMode will set to "AddItem" after that each column in the grid will save seperately to recrodset by refering the column name as mentioned above. But I could not found any samples similar to this in the website. This I want to use for for a data entry screen. Can you please send some sample code.
thanks
K.Philip
It looks to me like you are trying to use the UltraWinGrid without binding it to a DataSource. This will not work - the WinGrid requires a DataSource of some kind.
It need not be a DataBase - you can use a DataTable, UltraDataSource, BindingList<T>, List<T> or any object which implement the IList or IBindingList interface.