
XML trouble still - Sorry for bothering u guys again
I create a datatable, style e.t.c. at the top of my form with the following
code.
Dim dtPickle As New DataTable("Pickle")
Dim dgTSPickle As New DataGridTableStyle()
Dim dgC1 As New DataGridTextBoxColumn()
Dim dgC2 As New DataGridTextBoxColumn()
Dim dgC3 As New DataGridTextBoxColumn()
Dim dgC4 As New DataGridTextBoxColumn()
I then create my columns, add theses to the datatable and make this table
the source of a datagrid (Simplified a little here to keep it short)
'Add columns to datatable
dtPickle.Columns.Add(New DataColumn("Code", GetType(String)))
Me.DataGrid2.DataSource = dtPickle
'Create column styles and add to TableStyle
Me.dgC1.MappingName = "Code"
Me.dgC1.Width = 60
Me.dgC1.HeaderText = "Code"
'Add column styles to TableStyle
Me.dgTSPickle.GridColumnStyles.Add(dgC1)
'Add TableStyle to Datagrid
Me.DataGrid2.TableStyles.Add(dgTSPickle)
Me.DataGrid2.Refresh()
I then add rows to the datatable
Dim rowP As DataRow
rowP = dtPickle.NewRow()
rowP(0) = Me.txtCode.Text
dtPickle.Rows.Add(rowP)
And then I create a dataset, add the table to the dataset and write the
contents to an XML file.
Dim ds As DataSet = New DataSet()
ds.Tables.Add(Me.dtPickle)
ds.WriteXml("C:\mydata.xml")
The XML file is Blank.
WHY ???????