new in .net programming... insert new row in the data table

J

joel

Hi Guys ... I need some help on this... i know i've followed the right
declarations on this.. or if not i may be close on hitting it. And i
know there's something wrong with this code.


This is what i did... it adds a new row into the data table... with
values like department, sales glcode etc. when i click the insert/add
button it creates a new row with the values on it. but the second time
i try to insert a new row into the datatable,(via insert/add button
click) it doesnt add another row instead it overwrites the first
value inserted... i cant see where i went wrong or what is the right
property to call (rows.add or what?).

Any Help is very much appreciated!


thanks!



Dim i As Integer

For i = 1 To 1

Row1 = WarehouseDataTable.NewRow

Row1.Item("Department") = "Department" & i

Row1.Item("Sales GL Code") = "Sales GL Code" & i

Row1.Item("Cost of Sales") = "Cost of Sales" & i

Row1.Item("Inventory") = "Inventory" & i

Row1.Item("Expense GL Code") = "Expense GL Code" & i

Row1.Item("Reader's Fee GL Code") = "Reader's Fee GL Code" & i


Row1.Item("Department") = CStr(Me.cmbDepartment.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)

Next


Joel <----newbie!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top