venerable bede
Sep 24th, 2002, 12:16 PM
I added the following 2 lines to public class of a form:
Dim dsPick As New DataSet()
Dim dtPick As New DataTable("Pick")
I then added a grid to a form and in the form load() event added the following code:
dsPick.Tables.Add(dtPick)dtPick.Columns.Add(New DataColumn("Code",
GetType(String)))
dtPick.Columns.Add(New DataColumn("Description", GetType(String)))
dtPick.Columns.Add(New DataColumn("Quantity", GetType(String)))
Me.datagrid1.DataSource = dtPick
When the user clicks a button on the form the following code is executed.
The code is supposed to create a record but when I click the button nothing
happens.
Public Sub AddToTable()
Dim row As DataRow
row = dtPick.NewRow()
row(0) = "TEST STRING 1"
row(1) = "TEST STRING 2"
row(2) = "TEST STRING 3"
dtPick.Rows.Add(row)
End Sub
I am a bit inexperienced in this .Net business but I like to think that I am slowly getting there but I have to admit I am finding all these Datatables, Datasets e.t.c a bit hard.
Thanks in Advance
Dim dsPick As New DataSet()
Dim dtPick As New DataTable("Pick")
I then added a grid to a form and in the form load() event added the following code:
dsPick.Tables.Add(dtPick)dtPick.Columns.Add(New DataColumn("Code",
GetType(String)))
dtPick.Columns.Add(New DataColumn("Description", GetType(String)))
dtPick.Columns.Add(New DataColumn("Quantity", GetType(String)))
Me.datagrid1.DataSource = dtPick
When the user clicks a button on the form the following code is executed.
The code is supposed to create a record but when I click the button nothing
happens.
Public Sub AddToTable()
Dim row As DataRow
row = dtPick.NewRow()
row(0) = "TEST STRING 1"
row(1) = "TEST STRING 2"
row(2) = "TEST STRING 3"
dtPick.Rows.Add(row)
End Sub
I am a bit inexperienced in this .Net business but I like to think that I am slowly getting there but I have to admit I am finding all these Datatables, Datasets e.t.c a bit hard.
Thanks in Advance