Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27005

Unable to update Array/variables

$
0
0
Hey,

I have this lovely class here

vb.net Code:
  1. Public Class data
  2.  
  3.         Public Property Name As String
  4.         Public Property Subname As String
  5.         Public Property Type As String
  6.         Public Property parameter() As String
  7.         Public Property Summary As String
  8.  
  9.     End Class

And I use it to get data from an xml with this function here, which was put together with the help from one of the community members on here and worked wonderfully in previous use.

vb.net Code:
  1. Public Function getdata(location As String) As IEnumerable(Of data)
  2.  
  3.         Dim doc = XDocument.Load(location)
  4.  
  5.         Dim newdata = From n In doc.<UserEx>.<CompletionList>.<member>
  6.               Select New data With {
  7.                   .Name = n.@name,
  8.                   .Summary = n.<summary>.Value,
  9.                   .Type = .Name.Substring(0, 1)
  10.                   }
  11.  
  12.         Return newdata
  13.     End Function

So the Problem:

Once I get the data I try to update/change some of it using this for loop

vb.net Code:
  1. Dim newdata As IEnumerable(Of data) = getdata(location)
  2.         Dim temp As Integer = 0
  3.  
  4.         For Each line In newdata
  5.             temp = line.Summary.IndexOf("(")
  6.             If temp > 0 Then
  7.                 line.Subname = line.Summary.Substring(0, temp)
  8.                  'If I output it here "Console.Writeline(line.subname)" then it is right but if I output after the for loop it does not work :\
  9.             End If
  10.  
  11.         Next

But for some reason when I output it nothing is updated. I just get blanks, any reason why? :S
I have stepped through it and it does go through the if statement and I see it assign a value but nothing is changed when I output everything

Viewing all articles
Browse latest Browse all 27005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>