Hello everyone,
For an assignment, I load an xml file that lists the people per line.
The intent is to align these lines and split them up by the maximum length of the various data (maximum length of the name, maximum length of the country, etc.).
But I have no idea how i could do this.
Can anyone help me with this?
Form 1
Code:Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Public Persons As XElement Dim myNameLength As New LayoutClass If Persons Is Nothing Then TextBox1.Text = "no person was found" Else Dim queryData = From Person In Persons.Descendants("Person") Where (Person.Attribute("Name")).Value <> "" Select Naam = Person.Attribute("Name").Value, Country= Person.Attribute("Country").Value Order By (Name) TextBox1.Text = " " TextBox1.Text = "The persons are: " & vbCrLf & myNameLength.PersonNameLength End sub
Layout Class
Code:Public Class LayoutClass Public Property NameLength As Short = 16 Public Property CountryLength As Short = 16 Public Function PersonNameLength(PersonLength As Short) As Short Return Math.Max(PersonLength, NameLength) End Function End Class
Thanks for the effort!




Reply With Quote
