First of all - pb is the chemical symbol for lead and this is not an SMS
newsgroup so there is no need to abbreviate things.
The code you have shown will give you a table that looks like this:
FieldName EntryInfo Whatever
--------- --------- --------
Row 0 aaa
Row 1 bbb
Row 2 ccc
I assume that this is probably not what you want.
If, instead, you want this:
FieldName EntryInfo Whatever
--------- --------- --------
Row 0 aaa bbb ccc
then you need:
Dim dt As New DataTable
Dim row As DataRow
dt.Columns.Add("FieldName", Type.GetType("System.String"))
dt.Columns.Add("EntryInfo", Type.GetType("System.String"))
dt.Columns.Add("Whatever", Type.GetType("System.String"))
row = dt.NewRow
row("FieldName") = txtFieldName.Text
row("EntryInfo") = txtEntryInfo.Text
row("Whatever") = txtWhatever.Text
dt.Rows.Add(row)
"Sam" <sa**************@voila.fr> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Hi,
I'm adding columns to a datatable as followed. The values are from
textboxes or comboboxes.
The first column is properly field but then all the subsequent columns
just contain "", whereas the source txtboxes or comboboxes values are
correct. Why is that ?
thx
Dim dt As New DataTable
Dim row As DataRow
dt.Columns.Add("FieldName", Type.GetType("System.String"))
row = dt.NewRow
row("FieldName") = txtFieldName.Text
dt.Rows.Add(row) --> contains "the right string"
dt.Columns.Add("EntryInfo", Type.GetType("System.String"))
row = dt.NewRow
row("EntryInfo") = txtEntryInfo.Text
dt.Rows.Add(row) --> contains "" instead of "a string"