473,589 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Lengt h + 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
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.tex t, sna

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff in the os module got objectified properly (or at least with some semblance of OO propriety!) In the issues section:
by: mahesh | last post by:
Hi all, I have a doubt with OOAD and Dialogs. I have a Dialog Class. tkSimple.py It contains a class body as below. Now I am calling the tkSimple.py in another python program and using the default body, and everything from tkSimple.py. Now my requirement is as follows I need to popup a couple of other dialog boxes with a little difference in between each dialog and take
by: Peter | last post by:
Hi everybody, I am unfortunately stuck with a probably very simple problem. I made a class called Particle with a valarray (STL) as a class member. The code for the class goes like this: class Particle { private: valarray<double>* position;
by: Earl | last post by:
To upgrade or not? This, to me, is based upon whether or not Microsoft has -- at least -- fixed the buggy controls from VS2003: Combo (clearing and binding context issues) Checked ListBox (checked items losing status when control goes visible) Datagrid (header alignment to the right smashes into the grid) DataAdapter (creates timestamp for Insert command, amongst other oddities) Did I forget something? Does anyone know for certain if...
by: Ryan | last post by:
Hi all, I'm playing with Lutz Roeders Reflector and have found several areas where I think there are issues in the framework libraries. I can't see how the following should work as expected and the compiler gives me an error on the 'text1 = text1...' line. Is it really this buggy (this particular bug is in several places) or am I missing something? You can see that that code has a possibility of crashing if the property has a .. in it....
by: pkirk25 | last post by:
Hi, I want to create a class with its definition in cls.h and implementation in cls.cpp I get errors about redfinitions and errors wahtever way I try to initialise the static proivate variable *log_file. // cls.h: class logger
by: DirtySnipe | last post by:
I have created a php form with dynamic drop down boxes in it which pull the options from a database. The boxes work fine and the data gets submitted fine but im having a problem getting the box to default to a record of my choice from the database. (record 1 = None). Here is the code to what i have done. <input maxLength="40" size="30" name="name"></td> </tr> <tr> <td width="286" height="22"><b>Person Involved:</b></td> ...
by: Creativ | last post by:
Why does Thread class not support IDisposable? It's creating quite some problem. Namely, it can exhaust the resource and you have not control over it.
by: vern | last post by:
Greetings, how would I pass variables that are outside a class ... to a class? Such as ... $variable_one = 1; $variable_two = 2; class this_is_a_class { public $variable_one; public $variable_two;
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.