Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
im new to vb.net i would like to know how to insert another row for my datatable (like doing a for loop or something)... in this code it only inserts a single row. help pls. very much appreciated, joel Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click Dim WarehouseDataTable As DataTable WarehouseDataTable = New DataTable("Warehousing") 'creating a table named Customers Dim Row1 As DataRow 'declaring three rows for the table Try Dim Department As DataColumn = New DataColumn("Department") 'declaring a column named Name Department.DataType = System.Type.GetType("System.String") 'setting the datatype for the column WarehouseDataTable.Columns.Add(Department) 'adding the column to table Dim SalesGLCode As DataColumn = New DataColumn("Sales GL Code") SalesGLCode.DataType = System.Type.GetType("System.String") WarehouseDataTable.Columns.Add(SalesGLCode) Dim COSGLCode As DataColumn = New DataColumn("Cost Of Sales") COSGLCode.DataType = System.Type.GetType("System.String") WarehouseDataTable.Columns.Add(COSGLCode) Dim InventoryGLCode As DataColumn = New DataColumn("Inventory") InventoryGLCode.DataType = System.Type.GetType("System.String") WarehouseDataTable.Columns.Add(InventoryGLCode) Dim ExpenseGLCode As DataColumn = New DataColumn("Expense GL Code") ExpenseGLCode.DataType = System.Type.GetType("System.String") WarehouseDataTable.Columns.Add(ExpenseGLCode) Dim ReadersFeeGLCode As DataColumn = New DataColumn("Reader's Fee GL Code") ReadersFeeGLCode.DataType = System.Type.GetType("System.String") WarehouseDataTable.Columns.Add(ReadersFeeGLCode) Row1 = WarehouseDataTable.NewRow Row1.Item("Department") = Me.txtDepartment.Text Row1.Item("Sales GL Code") = Me.txtSalesGLCode.Text Row1.Item("Cost of Sales") = Me.txtCOSGLCode.Text Row1.Item("Inventory") = Me.txtInventoryGLCode.Text Row1.Item("Expense GL Code") = Me.txtExpenseGLCode.Text Row1.Item("Reader's Fee GL Code") = Me.txtReadersFeeGLCode.Text WarehouseDataTable.Rows.Add(Row1) Catch End Try Dim dsWarehouse As New DataSet dsWarehouse = New DataSet 'creating a dataset dsWarehouse.Tables.Add(WarehouseDataTable) ''adding the table to dataset Var_Warehouse.SetDataBinding(dsWarehouse, "warehousing") ''binding the table to datagrid End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
CLosing Linked datatable | Excel Programming | |||
Chart's DataTable | Charts and Charting in Excel | |||
CHARTS DATATABLE | Excel Programming | |||
how to delete row from the runtime Datatable | Excel Programming | |||
DataTable number format | Excel Programming |