Hey everyone, I have been searching and searching and cannot find out how to do what I'm looking to do, that is the only reason I would post a new thread.

So basically, I am wanting to read a file that looks similar to this:

DATA START
NOTES FILE
NOTE NameId="Name1" ColourId="13" Text="Test7" /
NOTE NameId="Name2" ColourId="6" Text="Test6" /
NOTE NameId="Name3" ColourId="10" Text="Test5" /
NOTE NameId="Name4" ColourId="7" Text="Test4" /
NOTE NameId="Name5" ColourId="8" Text="Test3" /
NOTE NameId="Name6" ColourId="3" Text="Test2" /
NOTE NameId="Name7" ColourId="1" Text="Teat1" /
NOTE NameId="Name8" ColourId="7" Text="test" /

DATA END

After reading the file, I want to load the NameId, the ColourId and the Text into a multidimensional array. Anything I have found about loading into an array shows text being separated by small delimiters like commas, but this I cannot do because I need to use this format. What I am wanting to do is load all of the NameId's into a listbox and when a certain NameId is selected, it will bring up the Text in a TextBox and the Colour value in a ComboBox. I just can't get this array to work with me.

Thanks in advance for all of the help.

-AbsolutHamm

Ok, here is a working snippet:

Public Class DataNotes 'to hold the information
	Public Property NameId As String
	Public Property ColorId() As Integer
	Public Property Text() As String
End Class

	Sub ReadData()
		Dim myData As New List(Of DataNotes)
		Dim regex As New Text.RegularExpressions.Regex("^NOTE NameId=""(.*)"" ColourId=""([0-9]{1,})"" Text=""(.*)""", Text.RegularExpressions.RegexOptions.Multiline)
		For Each match As Text.RegularExpressions.Match In regex.Matches(IO.File.ReadAllText("test.txt")) 'your file 
			myData.Add(New DataNotes With {.NameId = match.Groups(1).Value, .ColorId = CInt(match.Groups(2).Value), .Text = match.Groups(3).Value})
		Next
	End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.