I am creating a dataset from a simple XML file. A sample of it looks like this:
I read the file into a dataset without any problems. I was able to bind the dataset to a few text boxes. The problems is when I try to bind the "Tag" nodes to a listbox. I want the listbox to show all the tags for each note. The binding code that I am using is as follows:
Inside of the NotesDataClass is the following code for binding the data:
That code gives me a list of ID's in the listbox. When I change the .ValueMember to "Tag" it gives me an error. When I remove the .ValueMember then I get "System.Data.DataRowView".
What am I doing wrong here?
VB.NET:
<?xml version="1.0"?>
<ProgrammerNotes>
<Note ID="0">
<Title>First Note</Title>
<[COLOR=#6f002f]Date[/COLOR]>10/16/2012</[COLOR=#6f002f]Date[/COLOR]>
<Content>This [COLOR=#8515ea]is[/COLOR] my first note.</Content>
<Tag>test</Tag>
</Note>
<Note ID="1">
<Title>Second Note</Title>
<[COLOR=#6f002f]Date[/COLOR]>10/16/2012</[COLOR=#6f002f]Date[/COLOR]>
<Content>This [COLOR=#8515ea]is[/COLOR] my second note. It has multiple tags.</Content>
<Tag>Test</Tag>
<Tag>Programming</Tag>
<Tag>Result</Tag>
</Note>
</ProgrammerNotes>
I read the file into a dataset without any problems. I was able to bind the dataset to a few text boxes. The problems is when I try to bind the "Tag" nodes to a listbox. I want the listbox to show all the tags for each note. The binding code that I am using is as follows:
VB.NET:
[COLOR=#0000ff]With[/COLOR] tagsListBox
.DataSource = aNotesDataClass.NoteBindingSource
.DisplayMember = "Tag"
.ValueMember = "ID"
[COLOR=#0000ff]End[/COLOR] [COLOR=#0000ff]With[/COLOR]
Inside of the NotesDataClass is the following code for binding the data:
VB.NET:
[COLOR=#0000ff]With[/COLOR] _noteBindingSource
.DataSource = _notesDataSet
.DataMember = "Note"
[COLOR=#0000ff]End[/COLOR] [COLOR=#0000ff]With[/COLOR]
That code gives me a list of ID's in the listbox. When I change the .ValueMember to "Tag" it gives me an error. When I remove the .ValueMember then I get "System.Data.DataRowView".
What am I doing wrong here?