Here is a little more of the code so you can see how i am
trying to set up the DataTable.
' Create DataSet named DsnSentenceStuff.
Dim DsnSentenceStuff As New DataSet
("DsnSentenceStuff")
' Add one DataTable object, WordsinSentence
DsnSentenceStuff.Tables.Add(New DataTable
("WordsinSentence"))
' Create a Table in the dataset named
WordsinSentenceTable
Dim WordsinSentenceTable As DataTable
WordsinSentenceTable = New DataTable
("WordsinSentence")
' Add columns to table WordsinSentenceTable
WordsinSentenceTable.Columns.Add("intWordCount",
GetType(Int32))
WordsinSentenceTable.Columns.Add
("strWordInflect", GetType(String))
WordsinSentenceTable.Columns.Add("intKeyMeanid",
GetType(Int16))
WordsinSentenceTable.Columns.Add
("strTxtLangCode", GetType(String))
WordsinSentenceTable.Columns.Add
("strGestLangCode", GetType(String))
WordsinSentenceTable.Columns.Add
("strTransTxtLangCode", GetType(String))
WordsinSentenceTable.Columns.Add
("strTxtGestHeadWord", GetType(String))
WordsinSentenceTable.Columns.Add
("strKeyHeadWord", GetType(String))
WordsinSentenceTable.Columns.Add("strGestBinary",
GetType(String))
WordsinSentenceTable.Columns.Add
("strTransGestHeadword", GetType(String))
' Set PrimaryKey
WordsinSentenceTable.Columns
("intWordCount").Unique = True
WordsinSentenceTable.PrimaryKey = New DataColumn
() {WordsinSentenceTable.Columns("intWordCount")}
' Insert code to fill tables with columns and
data.
' Binds the DataGrid to the DataSet, displaying
the WordsinSentence table.
'Hmmm??? Why is the right datasource a table and
not a dataset??
'DataGrid2.SetDataBinding
(DsnSentenceStuff, "WordsinSentence")
DataGrid2.DataSource = WordsinSentenceTable
Dim myDataRow As DataRow
Dim i As Integer
For i = 0 To 4
myDataRow = WordsinSentenceTable.NewRow()
myDataRow("intWordCount") = i
myDataRow("strWordInflect") = "Item " +
i.ToString()
myDataRow("intKeyMeanid") = i * 2
myDataRow("strTxtLangCode") = "ASE"
myDataRow("strGestLangCode") = "Item " +
i.ToString()
myDataRow("strTransTxtLangCode") = "Item " +
i.ToString()
myDataRow("strTxtGestHeadWord") = "Item " +
i.ToString()
myDataRow("strGestBinary") = "Item " +
i.ToString()
myDataRow("strTransGestHeadword") = "Item " +
i.ToString()
WordsinSentenceTable.Rows.Add(myDataRow)
Next i
' Not sure I need this unless will update a
database using a data adapter.
'WordsinSentenceTable.AcceptChanges()
' YES! The data row has the data but does it make
it in to the dataset (or is it Data Table)??
TextBox2.Text = myDataRow("intWordCount") & " " &
myDataRow("strWordInflect")
Dim strExpr As String
Dim strSort As String
' strExpr = "intWordCount = 3 & strTxtLangCode =
ASE"
' Sort descending by CompanyName column.
' strSort = "intWordCount ASC"
' Use the Select method to find all rows matching
the filter.
Dim foundRows As DataRow() =
WordsinSentenceTable.Select(strExpr, strSort,
DataViewRowState.Added)
TextBox2.Text = foundRows("strTxtGestHeadWord")