Property & method question

i have1 container with 2 methods and 2 properties.
properties
tFile = folderitem
xDoc = xmlDocument

method 1 >LoadData
with code

[code] Dim savegame1,savegame2,savegame3,savegame4, _
savegame5,savegame6,savegame7,savegame8, _
savegame9,savegame10 as string

Dim folder as FolderItem =SpecialFolder.ApplicationData.Child(“mygame”)
Dim pValue as string
Dim count As Integer = folder.Count
For i As Integer = 1 to count
Dim f As FolderItem = folder.item(i)
If f <> Nil Then
pvalue = f.Name
End If
select case pvalue
Case “savegame1”
GameDirSelect.popmenu1.AddRow (“savegame1”)
Case “savegame2”
GameDirSelect.popmenu1.AddRow (“savegame2”)
Case “savegame3”
GameDirSelect.popmenu1.AddRow (“savegame3”)
Case “savegame4”
GameDirSelect.popmenu1.AddRow (“savegame4”)
Case “savegame5”
GameDirSelect.popmenu1.AddRow (“savegame5”)
Case “savegame6”
GameDirSelect.popmenu1.AddRow (“savegame6”)
Case “savegame7”
GameDirSelect.popmenu1.AddRow (“savegame7”)
Case “savegame8”
GameDirSelect.popmenu1.AddRow (“savegame8”)
Case “savegame9”
GameDirSelect.popmenu1.AddRow (“savegame9”)
Case “savegame10”
GameDirSelect.popmenu1.AddRow (“savegame10”)

end Select

Next
GameDirSelect.ShowModal
Dim xmlDoc As new XmlDocument
Dim getdata as String = selectsavedGame
Dim tFile as new FolderItem
tFile = SpecialFolder.ApplicationData.Child(“mygame”).Child(getdata).Child(“careerSavegame.xml”)
If tFile <> Nil And tFile.Exists Then
Dim t As text = tFile.Name.ToText
If t=(“careerSavegame.xml”) Then
xmlDoc.LoadXml (tFile)
GetTheData
Else
MsgBox “There is no CareerSavegame file!!”
End If
End If[/code]
the second method

[code]Dim nodes As XmlNodeList
Dim woodChips,manureLiquid,choppedRape,rye,klee,barley,wheat,seeds2,dryGrass_windrow,luzerne,beetPulp,chaff,rape,wheat_windrow,maize,grass,manureSolid,choppedStraw,sugarBeet,dryGrass,manure,grass_windrow,kalkSolid,potato,compost,choppedMaize,egg,oat,seeds,liquidManure,lettuce,compostSolid,sunflower as string

nodes = xmlDoc.XQL("//farmSiloAmount") <---------exception as NilObjectException

// Loop through results and display each name attribute
Dim node As XmlNode
Dim tName as string
Dim tValue as string
For i As Integer = 0 To nodes.Length-1
node = nodes.Item(i)
tName = node.GetAttribute(“fillType”)
tValue = node.GetAttribute(“amount”)

listbox1.AddRow(tName,tValue)

next[/code]

on the nodes = xmlDoc.XQL i get exception as NilObjectException
The xDoc property do not handle the xmlDocument ?
Property is Global
i have try to put the property in module but i get the same error!!

No time to examine your actual question unfortunately, but I wonder why not add the PopupMenu row with a simple:

GameDirSelect.popmenu1.AddRow pvalue

XMLDoc is defined within the scope of the first method, and therefore is local to that method
the second method has no reference to it, and therefore it is nil

DIM XMLDoc at the module level instead

[quote=217721:@Kem Tekinay]No time to examine your actual question unfortunately, but I wonder why not add the PopupMenu row with a simple:

GameDirSelect.popmenu1.AddRow pvalue [/quote]
I want the user to get only folder names.i have try your example but i get and the files.
Because i am on learning curve i am sure i will find it… :wink:
Dave[quote=217722:@Dave S]XMLDoc is defined within the scope of the first method, and therefore is local to that method
the second method has no reference to it, and therefore it is nil

DIM XMLDoc at the module level instead[/quote]

Dave How i get the reference in the property from the second Method ?
I want the property to be in the container and no in the module…

if both methods are in the container, the just move the declaration to the container level…
but it cannot be inside the method… it has to be at a level the is common to both methods

and I concur with Kem’s idea as well.

You should be using your property xDoc instead of a local variable xmlDoc.

Is the code bellow the right method to get only the specific Folder names?
Is working in my app.

[code] If f <> Nil Then
  
  if f.Directory then
    dim t as Text = f.DisplayName.ToText
    
    if  t.BeginsWith ("savegamebackup") then
      
    elseif t.BeginsWith ("savegame") then
      
      pvalue = f.Name
      GameDirSelect.popmenu1.AddRow pvalue
    end if
   end if
end if[/code]