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

storing data in class's

$
0
0
Hi,

What im trying to do is, store somedata into classes so i can easily access it and change it a little like a table. Im using the data with treeview to display it (mainly for practice, but also because theres 3 levels, i dont want to display a table for each level).

the data is very simple

Filename <top>
--Title/Name <level 1>
----Items <level 2>

I initially create a (ClassDataItems) to hold the Names and the list of Items, which gave me some problems when i wanted to distinguish the filenames.
so i made a (ClassFiles) for the filenames and put a list of (ClassDataItems) inside it. and then use a list of (Classfiles)

inside each class there is some methods to sort the data eg. (ClassDataItems) has a method to remove duplicate items
also (classfiles) has a method which loads the files, another to parse them, and then passes the data as a list of Structure(name, string(delimited items)) to the (ClassDataItems) which puts them into a list via the NEW method

with <TreeView1> when a node is expanded i get the nodes <level> and <index> and get the relevant items from the classes to create the nodes for that data.

i have <TreeView2> which im using to display selected items on <treeview1> (selected with checkboxes)

i was thinking just to use a list of <ClassDataItems> to store the items in treeview2,

am i doing this right, i keep getting a voice in my head saying i need more classes and to split the data further!?
or inherit instead of making new instances?!
how can i handle it easily,

this is a simple layout of my classes and types
Code:

class DataItems
private Name as string
private Items as list(of string)
end class

class Files
private Path as string
private Items as list(of DataItems)
end class

Module mod1

public Structure DataLines
Name as string
Items as string
end structure
public loadedData as List(of Files)
public SelectedData as List(of DataItems)
end module


Viewing all articles
Browse latest Browse all 27159

Trending Articles



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