469,647 Members | 1,725 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Class goes buggy

hi, im working on this app that makes a treenode view out of data from an xml page, yet theres a few pieces of code that just will not get fixed by me.

Anybody help me

(code below

'Class guildnode (Array of members, array index 0 contains name of the group, thus will not be returned with the getit method

Public Class guildnod
Private node(2) As TreeNode 'node(0) contains the name of the group, node(1 to N) contains members
Private tot As Integer 'Total number of members in the nodes() arra
Sub New(ByVal gname As String
node(0) = New TreeNode(gname) 'stores the name of the grou
tot =
End Su
Function add(ByVal name As String) 'add a member to the arra
node(tot) = New TreeNode(name
tot = tot +
If tot = node.Length - 1 Then 'if the array gets to close to reaching the upper bounds, redimension it to make it bigge
ReDim Preserve node(node.Length + 1
End I
End Functio
Function getit() As TreeNode() 'get the members of the grou
Dim nod(tot - 1) As TreeNod
Dim i As Intege
For i = 1 To tot -
nod(i - 1) = node(i
Nex
Return no
End Functio
Function getguildname() As Treenode 'get the name-treenod
Return node(0
End Functio
Function total() As Integer 'get the total amount of members in it - 1 for the spare room for a new membe
Return tot -
End Functio
End Clas

ok, the script continues, members get loaded in another array, which from there will be transfered to the correct group array member (basically i use an array of that class, 1 for every group, number of groups can fluctuate

then this
Dim sna() As TreeNode = snodes(0).getit 'Returns guildnode0 (always exists
Dim snb() As TreeNode = snodes(1).getit 'Returns guildnode1 (always exists
Dim sbc() As TreeNode = snodes(2).getit 'Returns guildnode2 (always exists
Dim staff(6) As TreeNod

then the buggy line

staff(0) = New TreeNode(snodes(0).getname.text, sna

it gives this exception
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dl
Additional information: Object reference not set to an instance of an object.
Nov 20 '05 #1
0 792

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

31 posts views Thread by John Roth | last post: by
reply views Thread by mahesh | last post: by
3 posts views Thread by Peter | last post: by
9 posts views Thread by Ryan | last post: by
7 posts views Thread by pkirk25 | last post: by
3 posts views Thread by vern | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.